出了一个js的题。

class test {
set xx(v){
console.log('i am set');
this.__ok = v;
}

get xx(){
console.log('i am get');
return 100;
}
}

function testFn(){
const y = new test();
return y.xx = 200;
}

console.log(testFn());

上面段代码执行将打印出什么内容,为什么?

posted @ 2018-09-14 11:47  王大鹏  阅读(141)  评论(0编辑  收藏  举报