JavaScript题目

["1", "2", "3"].map(parseInt)
	// 结果为:[1, NaN, NaN]

[typeof null, null instanceof Object]
// 结果为:["object", false]

[
	[3, 2, 1].reduce(Math.pow), [].reduce(Math.pow)
]
// 结果为:报错

new String('A')
	// 结果为:String {0: "A", length: 1, [[PrimitiveValue]]: "A"}

String('A')
	// 结果为:"A"

[] == []
// 结果为:false

parseInt(3, 8)
	// 结果为:3
parseInt(3, 2)
	// 结果为:NaN
parseInt(3, 0)
	// 结果为:3

Array.isArray(Array.prototype)
	// 结果为:true

var a = [0];
if ([0]) {
	console.log(a == true)
} else {
	console.log("wut")
}
// 结果为:false

var arr = Array(3);
arr[0] = 2;
arr.map(function(elem) {
		return '1'
	})
	// 结果为:["1", undefined × 2]

[1 < 2 < 3, 3 < 2 < 1]
// 结果为:[true, true]

3. toString()
	// 结果为:报错

3..toString()
	// 结果为:"3"

3...toString()
	// 结果为:报错

你可能感兴趣的:(JavaScript题目)