链家笔试题总结

一、

var name="abc";
var person={
    name:'cba',
    getName:function () {
        return this.name;
    }
}
console.log(person.getName());
var p1=person.getName;
console.log(p1());
var p2=new p1();
console.log(p2.name);

二、

var v='cba';
(function () {
    var v='abc'
    function A() {
        var v='a'
        this.getV=function () {
            console.log(v);
        }
    }
    function B() {
        var v='b'
        A.call(this);
    }
    var b=new B();
    b.getV();
}())

三、

var i=1;
(
    function () {
        var s = new Date().getTime();
        var si = setInterval(function () {
            var n =  new Date().getTime();
            if(n <(s+100)){
                i++;
            }else{
                console.log(i);
                clearInterval(si);
            }
        },10)
    }
)()

四、

var foo=1;
function main() {
    console.log(foo);
    var foo=2;
    console.log(this.foo);
    this.foo=3;
}
main();
new main()

五、

function one() {
    this.name = 1;
    function two() {
        this.name = 2;
        function three() {
            var name = 3;
            console.log(this.name);
        }
        return three;
    }
    return two;
}
one()()();

六、

这里写代码片
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值