js-code

118 阅读1分钟

第一组:

题1

var a = 'abc' + 123 + 456;
var b = '456' - '123';
var c = 100 + true + 21.2 + null + undefined + "Tencent" + [] + null + 9 + false;
console.log(a, b, c);

题2

var str = 'abc123';
var num = parseInt(str); 
    if(num == NaN) {
    alert(NaN);
}else if(num == 123) {
    alert(123);
}else if(typeof num == 'number') {
    alert('number');
}else {
    alert('str');
}
// 能输出"1"的有哪些
A. alert(1);
B. console.log(parseInt(1.3));
C. console.log(1);
D. console.log(isNaN(1));
E. console.log(parseInt("1"));
// 下面结果是"undefined"的是
console.log(alert(1));
typeof undefined;
console.log(parseInt(undefined));
isNaN(undefined);