SOURCE

//1.  symbol
let sy= Symbol("xiaopengzai");
// console.log(sy);
console.log(typeof(sy));


//2.  es6的字符串中的子串的识别
//es6之前判断字符串是否包含子串,用indexof方法
//es6新增子串识别的办法

//includes():  返回布尔值,判断是否找到参数字符串
//startsWith(): 返回布尔值,判断字符串是否在原字符串头部
//endsWith():   返回布尔值,判断字符串是否在原字符串尾部  

let string ="fu,xin,peng";
string.includes("xin");
console.log(string.includes("xin"),"includes");

string.startsWith("xin");
console.log(string.startsWith("xin"),"不在startsWith的头部");
string.startsWith("fu");
console.log(string.startsWith("fu"),"在startsWith的头部");

string.endsWith("fu");
console.log(string.endsWith("fu"),"不在endsWith的头部");
string.endsWith("peng");
console.log(string.endsWith("peng"),"在sendsWith的尾部");

//此方法都可接受两个参数,(需要搜索的字符串,可选的搜索其实位置的索引)
string.startsWith("xin",3);
console.log(string.startsWith("xin",3),"字符串+索引值");




//3.  字符串重复
repeat:
console 命令行工具 X clear

                    
>
console