[...[..."..."]].length
3
[...[...["..."]]].length
1
var a =[...[[1,2],[1,3]]]
undefined
a
[Array[2], Array[2]]
let a = (1,2)
undefined
console.log(a);
2
undefined
String.prototype.substring()
、String.prototype.slice()
、String.prototype.substr()
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/String/slice
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/String/substr
String.prototype.substring(startIndex,endIndex)
:[startIndex,endIndex)
默认情况下相当于:[startIndex,str.length)
返回新数组,对原数组不会进行更改。
substring 会将负数设置为0,然后把较小的一个赋值给startIndex,把较大的一个赋值给endIndex。
String.prototype.slice(beginIndex[, endIndex])
:[startIndex,endIndex)
默认情况下相当于:[startIndex,str.length)
slice() 方法提取某个字符串的一部分,并返回一个新的字符串,且不会改动原字符串。
startIndex
,从该索引(以 0 为基数)处开始提取原字符串中的字符。如果值为负数,会被当做 strLength + beginIndex 看待,这里的strLength 是字符串的长度
endIndex
可选。在该索引(以 0 为基数)处结束提取字符串。如果省略该参数,slice() 会一直提取到字符串末尾。如果该参数为负数,则被看作是 strLength + endIndex,这里的 strLength 就是字符串的长度
如果startIndex
所指代的位置在 endIndex
指代位置的右边 ,则返回空字符串。
如果是负数的话,直观来看,相当于从最后一个开始倒数,不过是从-1开始倒数的。还是左闭右开
如果只传入一个数,无论正负,第二个数都自动取字符串的长度。
String.prototype.substr(start[, length])
substr() 方法返回一个字符串中从指定位置开始到指定字符数的字符。
start代表一个位置,规则同上,不过,当start为负值,并且到达最右边后,可以认为会被置为0位置。
https://zhidao.baidu.com/question/131481828.html
https://blog.csdn.net/KenBerkeley/article/details/50983734
type的类型:
https://blog.csdn.net/i_dont_know_a/article/details/80790526
网友评论