最近学习jdk1.8源码时,发现ArrayList(Collection<? extends E> c)这个构造函数中,有句有意思的描述:c.toArray might (incorrectly) not return Object[] (see 6260652), 做了一些实验后均没能解释why!而后发现通过正常方式创建的Collection参数都是不会有问题的,问题出在这个Collection参数如果通过某些方式创建得到,就会出现如题的问题! public static void main
https://stackoverflow.com/questions/4775722/check-if-object-is-an-array One of the weird behaviour and spec in Javascript is the typeof Array is Object. You can check if the variable is an array in couple of ways: var isArr = data instanceof Array; v
js对象的核心是一个字符串属性名与属性值的映射表.使用对象实现字典易如反掌,字典是可变长的字符串与值的映射集合. for...in js提供了枚举一个对象属性名的利器--for...in循环. var dict={zhangsan:34,lisi:24,wangwu:62}; var people=[]; for(var name in dict){ people.push(name+":"+dict[name]); } people;//["zhangsan:34"