解析Javascript中难以理解的11个问题
1.原始值与引用值 原始值存放在栈里, 引用值存放在堆里. 如程序: 代码如下:function Person(id,name,age){ this.id = id; this.name = name; this.age = age;} var num = 10;var bol = true;var str = “abc”;var obj = new Object();var arr = [‘a’,’b’,’c’];var person = new Person(100,”笨蛋的座右铭”,25); 2.undefined和null undefined: 变量未定义; 是Undefined类