前端面试js部分
一、变量类型
1.值类型

2.引用类型
1)包括:对象,数组,函数。
2)特点:1.无限扩展属性(为了与内存共用空间)
2.都具有对象特性(null除外)
3.都有__proto__属性(隐式原型)
4.所有函数都有 prototype(显示原型)
5.__proto__属性指向它的构造函数的prototype值( var obj={}; obj.__proto__===Object.prototype //true)
6.当试图得到一个对象的某个属性时,如果这个对象本身没有这个属性,那么会去它的__proto__(即它的构造函数的prototype)中寻找。

二、typeof运算符
1.undefined
2.string
3.number
4.booleans
5.object
6.function

三、“==”运算符
100=="100"//true;
0==' '//true;
null==undefined//true;
注:几个特殊
0,NaN,' ',null,undefined,false 均返回false

四、原型规则例子
//构造函数
funciton Foo(name,age){
this.name = name;
}
Foo.prototype.alertName = function(){
alert(this.name);
}
//创建示例
var f = new Foo('zhangsan')
f.printName = function(){
console.log(this.name)
}
//test
f.printName();
f.alertName();
f.toString();


五、函数声明和函数表达式
1、函数声明和函数表达式

2、this的用法:this要在执行时才能确认值,定义时无法确认

1)this作为构造函数来执行

2)this作为对象属性来执行

3)this作为普通函数执行

4)call apply bind方式
