types & grammer
- 判断以下结果
var s = 'abc';
s[1] = 'B';
console.log(s);
var l = new String('abc');
l[1] = 'B';
console.log(l);- 如何逆序一个字符串?
- 接上,为什么不能直接使用
Array.prototype.reverse.call(s)逆序字符串? - 判断以下结果,为什么会出现这样的情况,如何做出正确的比较?
0.1 + 0.2 === 0.3;
0.8 - 0.6 === 0.3;-
如何判断一个数值为整数?
-
如何判断一个数值为 +0?
-
'abc'.toUpperCase()中 'abc' 作为 primitive value,如何访问toUpperCase方法 -
判断以下结果
Array.isArray(Array.prototype)
- 判断以下结果
Boolean(Boolean(false));
Boolean(document.all);
[] == '';
[3] == 3;
[] == false;
42 == true;- 找出以下代码问题 (TDZ)
var a = 3;
let a;- 找出以下代码问题 (TDZ)
var b = 3;
function foo( a = 42, b = a + b + 5 ) {
// ..
}
foo()scope & closures
var a = 2中,Engine,Scope,Compiler做了什么工作- 判断以下结果 (Lexical Scope)
var scope = 'global scope';
function checkscope () {
var scope = 'local scope';
function f() {
return scope;
}
return f;
}- 判断以下结果 (Hoisting)
console.log(a);
var a = 3;- 判断以下结果 (Function First)
var foo = 1;
function foo () {
}
console.log(foo);- 判断以下结果 (IIFE & Function First)
var foo = 1;
(function () {
foo = 2;
function foo () {
}
console.log(foo);
})()
console.log(foo);- 判断以下结果,如何按序输出 (Closure)
for (var i = 0; i < 10; i++) {
setTimeout(function () {
console.log(i);
}, i * 1000)
}this & object prototypes
- 判断以下结果 (Default Binding)
function foo() {
"use strict";
console.log( this.a );
}
var a = 2;
foo();- 判断以下结果
"use strict";
var a = 2;
console.log(this);- 判断以下结果 (Strict Mode & Default Binding)
function foo() {
console.log( this.a );
}
var a = 2;
(function(){
"use strict";
foo(); // 2
})();- 判断以下结果 (Hard Binding)
function foo () {
console.log(this.a);
}
const o1 = { a: 3 };
const o2 = { a: 4 };
foo.bind(o1).bind(o2)();-
如何实现
Function.prototype.bind与Function.prototype.softBind -
new的过程中发生了什么,判断以下结果 (new)
function F () {
this.a = 3;
return {
a: 4;
}
}
const f = new F();
console.log(f.a);- 什么是
data descriptor和accessor descriptor - 如何访问一个对象的属性与如何对一个对象的属性赋值 ([[Get]] & [[Put]])
- 如何遍历一个对象 (?iterator)
- 如何实现一个继承 (Object.create & call)
- 如何实现
__proto__ - 如何实现
Object.create