面试题

时间:2019-04-11 15:25:15   收藏:0   阅读:107
var v = 123;
function foo(){
    var v = 456;
    function inner(){
        console.log(v)
    }
    return inner
}

result = foo()
console.log(result()) 

# 问输出结果://456

Name=root;
Age = 18;
function Foo(name,age){
    this.Name = name;
    this.Age = age;
    this.Func = function(){
        console.log(this.Name,this.Age);
        (function(){
             console.log(this.Name,this.Age);
        })();
    }
}
obj = new Foo(alex,666);
obj.Func()

# 问输出结果:
// alex 666
// root 18

 

原文:https://www.cnblogs.com/xiangtingshen/p/10689744.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!