数组:
unshift // 往前添加(支持多个)
push // 往后添加
shift // 删除第一个元素
pop // 删除最后一个元素
toString // 将数组转字符串
join // 将数组转化为字符串
concat // 链接数组(合并)
slice(start,end) // // 数组截取
splice(start,len,item...) // 修改原数组
indexOf(item1,item2) // item1要查找的元素,item2查找起始索引,返回索引
lastIndexOf(item1,item2) // 同上 从后往前找
reverse // 反转数组 改变原数组
sort // 默认从小到大 sort((a,b)=> return a-b)
// 不改变原数组的方法:
1、concat();
2、join();
3、slice();
字符串:
length // 字符串长度
str[key] //
charAt() // 获取指定位置的字符
charCodeAt // 获取指定位置字符的ASCII码
concat // 链接字符串
slice // (start,end)字符串截取
substring(start,end) // 和slice相似 截取到哪
substr(start,len) // 截取片段
replace(value,rep) // 替换元素 只会替换查找到的第一个元素
toUpperCase // 转换成大写字母的新字符串
toLocaleLowerCase // 转换小写
trim // 去除前后空格
split // 分割字符串,转数组