javascript是一种面向对象的语言,所有的函数都是具有调用者的,即:this。简写:
alert(parseInt("1"));全写:
window.alert(window.parseInt("1"));就是说,alert方法和parseInt方都是由window对象调用的。function helloWorld() {
    alert(this == window); // true
}window.helloWorld();这样的声明helloWorld()将成为window对象的一个方法。function class(){ this.msg = "zswang 路过"; }
class.prototype.helloWorld2 = function() {
    alert(this.msg);
}var object = new class();
object.helloWorld2(); // zswang 路过
简单的说:函数不同的声明带来不同的this。