JavaScript对字符串操作方法
let str = “Apple, Banana, Kiwi”;
join() str.join(“”) ;
split() str.split(“,”) ;
slice() str.slice(7, 13);
substring() str.substring(7, 13);
substr() str.substr(7, 13);
replace() str.replace(“Apple”, “Pear”);
toUpperCase() str.toUpperCase();
toLowerCase() str.toUpperCase();
concat() let text3 = text1.concat(" ", text2);
trim() ltext1.trim();
indexOf() str = str.indexOf(“Apple”);
lastIndexOf() str = str.lastIndexOf(“Apple”);