下面哪些属于JavaScript的typeof运算符的可能结果:()
symbol 。
int
boolean 。
null
array
undefined 。
string 。
2.存在变量 var a = 10.42; 取出 a 的整数部分,以下代码哪些是正确的?
parseInt(a);
Math.floor(a); //向下取整
//向上取整Math.ceil(a);
a.split('.')[0];
3.下列哪些会返回false?
null
undefined
0
'0'
D选项为string类型的哦
4.以下输出结果为object的是( )
typeof null //object
typeof undefined //undefined
typeof [] //object
typeof 5 //number
5.下列代码存在几个变量没有被回收?( )
1 2 3 4 5 6 7 8 9 10 11 |
|
0个
1个
2个
3个
解析:全局变量不会被回收;全局作用下的函数不会被回收;闭包下引用的局部变量不会被回收。
6.以下哪个表达式的值为true?
'1' === 1
isNaN(1/0) //infinity
1 in [1]
1 && 2 > 1