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());
上面段代码执行将打印出什么内容,为什么?
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());
上面段代码执行将打印出什么内容,为什么?