for(var i=0; i<6; i++) { setTimeout(() => { console.log(i) }) }
以下代码输出
var a = function(){ this.b = 3 } var c = new a() a.prototype.b = 10 var b = 7 a() console.log(b)//3 console.log(c.b)//3
代码输出什么
function Foo() { getName = function () { console.log(1); } }
var getName = function () { console.log(4); };
function getName() { console.log(5); }
Foo.getName = function () { console.log(2) }
Foo.prototype.getName = function () { console.log(3); }
Foo.getName()
getName()
new Foo.getName()
## 算法 1. 给两个数组[1,2,3],[2,1,3,4],如果A包含于B返回1,B含于A返回2,其他返回0 2. 无重复的字符串字串 3. 合并两个有序链表 ## 手写 1. 手写一个Promise.all 2. 手写Promise,包含简单的逻辑即可 2. 用reduce实现map 3. 手写一个repeat函数,要求每隔3秒alert一次helloWorld,总共输出4次
function repeat(func, times, wait){ ... } var rp = repeat(alert, 4, 3) rp('helloWorld')
4.