一split(),
当split无参时,表示将调用者整个字符串存入到数组中。
javascript
// 将整个字符串存到数组中
value='za,we,ds,aw'
value.split(); ==>["za,we,ds,aw"]
## split()函数参数为空字符串时:
javascript
// 将字符串中每个字符单独存到数组中
value='za,we,ds,aw'
value.split(''); ==>["z","a",",","w","e",",","d","s",",","a","w"]
## split()函数参数为指定字符串时:
javascript
// 按照指定字符串截取转换为数组
value='za,we,ds,aw'
value.split(','); ==>["za","we","ds","aw"]
二,reverse()
将指定数组倒序排序并返回
javascript
value='za,we,ds,aw'
value.split(',').reverse(); ==>["aw","za","we","ds"]
三join()
## join()函数无参时:
将指定数组中全部数据用','逗号连接转换为一个字符串
javascript
value='za,we,ds,aw'
value.split(',').reverse().join(); ==>"aw,za,we,ds"
## join()函数参数为空字符串时:
将指定数组中全部数据转换为一个字符串
javascript
value='za,we,ds,aw'
value.split(',').reverse().join(''); ==>"awzaweds"
## join()函数参数有参时:
将指定数组中全部数据按照指定字符连接,并转成一个字符串
javascript
value='za,we,ds,aw'
value.split(',').reverse().join('+'); ==>"aw+ds+we+za"