1、//example 1

           var Person = function () { };

           var p1 = new Person();

           p1.name = "jack";

           p1.age = 25;

           var p2 = new Person();

           alert(p1.name);  //jack

           alert(p2.name);  //undefined

 //example 2

 function CreateUser(name,qq) {

            this.name = name;

            this.email = qq;

        };

        window.onload = function () {

            obj1 = new CreateUser('a',321);

            var obj2 = new CreateUser('b',123);

            alert(obj1.email);

            alert(obj2.email);

        };

2、继承

    function A(email) {

        this.name = 'a';

        this.email = email;

    }

    A.prototype.show = function () {

        alert(this.email);

    };

    //继承A

    function B(email) {

        A.call(this, email);

    }

    ////引用赋值定义A.prototype.say B也具有say()方法

    //B.prototype = A.prototype;        

    //B.prototype.say = function () {

    //    alert('My Name is '+this.name);

    //}

   

    for (var i in A.prototype) {

        B.prototype[i] = A.prototype[i]

    }

    B.prototype.say = function () {

        alert('My Name is ' + this.name);

    }

    var objA = new A('A@@.com');

    var objB = new B('B@@.com');

    objA.say(); //错误