function HotTag(parent){
    //自动执行初始化(xxx,xxx)
    this.init(parent);//this--->remen  remen.init()
    //remen--->remen.__proto__(HotTag.prototype)
    //return this;
}
//初始化
HotTag.prototype.init=function(parent){
    //this-->remen(HotTag的实例)
    //1、初始化页面
    this.initDom(parent);//remen.__proto__
    //2、绑定事件
    this.bindEvents();//HotTag.prototype.bindEvent
};
HotTag.prototype.initDom=function(parent){
    //this--->remen
    //作为热门标签的容器
    var div=document.createElement("div");
    div.className="hottag-container";
    var h1=document.createElement("h1");
    h1.innerText="热门标签";
    var h3=document.createElement("h3");
    h3.innerText="内容。。。。。。。。。。";
    div.appendChild(h1);
    div.appendChild(h3);
parent.appendChild(div);
    //将功能的容器作为对象的属性(目的:在其他方法中可以访问到容器-->可以访问到容器里面
的元素)
    this.container=div;//设置remen对象的自有属性container
};
//绑定事件
HotTag.prototype.bindEvents=function(){
    //this-->remen
    this.container.querySelector("h1").onclick=function(){
        alert("点击了热门标签");
    };
    this.container.querySelector("h3").onclick=function(){
        alert("点击了内容");
    };
};
var remen=new HotTag(document.body);
函数的创建
//声明式
    function f1(){} //new Function()
    //函数表达式
    var f2=function(){}; //new Function()
    //创建一个无参无返回值的函数
    var f3=new Function("var a=10;a++;console.log(a);console.log(‘你还好吗?‘)");
    //创建一个有一个参数的函数
    var f5=new Function("num1","console.log(num1);");
    //创建2个参数的函数
    var f6=new Function("a","b","console.log(a+b);");
    //a1,b1,c1--->a1++   b1+c1
    var f7=new Function("a1","b1","c1","a1++;console.log(a1);console.log(b1+c1);");
//结论1:任何函数都是Function的实例
function foo(){}
    //foo.__proto__===Function.prototype
    //Function.prototype.constructor===Function
 //Function--->本身就是一个函数:自己创建了自己
//Array,构造函数,原型对象
    //结论2:Function.prototype继承自Object.prototype
    // Function.prototype.__proto__===Object.prototype
    //Function Function.prototype
    //Object Object.prototype
原文:http://www.cnblogs.com/sw1990/p/5907682.html