第一题数组
const out = 25;
const inner = {
out: 20,
func: function () {
return this.out;
}
};
console.log((inner.func, inner.func)());
console.log(inner.func());
console.log((inner.func)());
console.log((inner.func = inner.func)());
答案:undefined,20,20,undefined;
复制代码
第二题bash
var a = 1;
function a() {
console.log(2);
}
console.log(a);
答案:1;
复制代码
第三题oop
const a = 1;
function a() {
console.log(2);
}
console.log(a);
答案:报错,变量a重复声明;
复制代码
第四题ui
function b(x, y, a) {
arguments[2] = 10;
console.log(a);
}
b(1, 2, 3);
答案:10;
复制代码
第五题this
function a() {
console.log(this);
}
a.call(null);
答案:window;
复制代码
第六题spa
const a={};
const b={ key: 'b' };
const c={ key: 'c' };
a[b] = 123;
a[c] = 456;
console.log(a[b]);
答案:456;
复制代码
第七题code
不使用loop循环,建立一个长度为100的数组,而且每一个元素的值等于它的下标。
let a = new Array(100);
a = a.join(',').split(',').map((item,index) => index);
复制代码
题目还在持续更新中···,有题目贡献能够留言在下方交流。string