出了一个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());

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

原文地址:https://www.cnblogs.com/web2-developer/p/9645646.html