前端常见笔试题

1、

console.log(Array.isArray(Array.prototype));    // true   Array.prototype 本身也是一个 Array。
console.log(Array.isArray(Person.prototype));   //false   Person.prototype是一个对象
let a =['1','2','3'].map(parseInt)
console.log(a);    //[1, NaN, NaN]
//上面的代码实际上等于:
['1','2','3'].map(parseInt(val,index))  //parseInt(string, radix) 的参数radix必须介于2~36之间,而且字符串string中的数字不能大于radix才能正确返回数字结果值。
                         //parseInt('1',0) = 1,
                          //parseInt('2',1) = NaN,
                         //parseInt('3',2) = NaN,

猜你喜欢

转载自www.cnblogs.com/wenxuehai/p/10459275.html