1. 获取字符串长度

const str = 'hello';
str.length;   // 输出结果:5

2. 获取字符串指定位置的值

charAt()charCodeAt() 方法都可以通过索引来获取指定位置的值

charAt

const str = 'Lance';
console.log(str.charAt(1)); // a

charCodeAt

const str = 'Lance';
console.log(str.charCodeAt(1)); // 97

3. 检索字符串是否包含特定序列

🌈 indexOf