userDefineFunc.js

var scareMe = function(){
    console.log("cynthia")
    scareMe = function(){
        console.log("wuqian")
    }
}

scareMe() //cynthia
scareMe() //wuqian


// 添加一个新属性newPro
scareMe.newPro = "addProperty"
console.log(scareMe.newPro) //addProperty


// 把函数对象scareMe分配给一个新的变量prank
var prank = scareMe ;
console.log(prank.newPro) //addProperty
prank() //wuqian
prank() //wuqian

 

posted @ 2015-11-10 17:34  Cynthia娆墨旧染  阅读(117)  评论(0编辑  收藏  举报