JavaScript中容易忽视的问题

1.最大数为2^53,+1还是2^53

2.String('A')==='A';new String('A')!=='A'

3.小数进行运算有精度一般不能这么用小数比较,可以扩大精度至整数

4.typeof null 为"object",null instanceof Object 为false

5.数组.filter时undefined不会触发

6.-9 % 2 = -1;后台语言会返回1

7.parseInt(A,B)  ;A为B进制的数,B为进制,结果返回10进制的数,B不合法就默认为10或者NaN。

8.Array.isArray( Array.prototype ) = true

9.var a = [0]; if (a) {console.log(a == true);}

10. map is only invoked for elements of the Array which have been initialized.

11. in javascript variables are tied to the arguments object so changing the variables changes arguments and changing arguments changes the local variables even when they are not in the same scope.

12.var a = 111111111111111110000, b = 1111; a + b;

13.https://javascript-puzzlers.herokuapp.com/

14.Number.MIN_VALUE == 5e-324

15.2 == [[[2]]]

16.3..toString() = "3"

17.name is a read only property

18.Date(0) 当前时间,new Date(0);1970

19.var min = Math.min(), max = Math.max() min > max  Infinity > -Infinity

猜你喜欢

转载自www.cnblogs.com/sz-toosimple/p/11424611.html