JavaScript——字符串
字符串
1.正常字符串我们使用单引号,或者双引号包裹
2.注意转义字符
1 \' 2 \n 3 \t 4 \u4e2d \u#### Unicode字符 5 \x41 Ascll字符
3.多行字符串编写
1 //tab键上面 esc键下面 2 var msg= 3 `hello world 4 你好啊 5 你好呀`
4.模板字符串
1 //tab键上面 esc键下面 2 let name="cl"; 3 let age=19; 4 5 let msg=`你好呀${age}岁的${name}`
5.字符串长度
1 str.length
6.字符串的可变性,不可变

7.大小写转换
1 //注意:这里是方法,不是属性 2 student.toUpperCase() 3 student.toLowerCase()
8. student.indexOf('t') //字母t出现的第一个位置数
9.substring
1 [) 2 student.substring(1) //从第一个字符串截取到最后一个字符串 3 student.substring(1,3) //[1,3)

浙公网安备 33010602011771号