来到新公司上班已经快一个月的时间,趁着空闲时间把本身这段时间的面试题进行一波总结,避免再次踩坑,有些问题仍是须要本身去查一下,有时间的话会把答案补全前端
class
.prototype
的新对象被建立。Foo
,并将 this
绑定到新建立的对象。new Foo
等同于 new
Foo
()
,也就是没有指定参数列表,Foo
不带任何参数调用的状况。new
表达式的结果。若是构造函数没有显式返回一个对象,则使用步骤1建立的对象。(通常状况下,构造函数不返回值,可是用户能够选择主动返回对象,来覆盖正常的对象建立步骤)//生成验证码 function verificationCode(){ let code = (Math.random()*100000000).toFixed(0) //console.log(msg,msg.length)) //长度不够8位的补0 while(msg.length<8){ code = "0" + code console.log(code) } return code } function message(){ //使用对象存放验证码 let codes = {} //let arr = [] let index = 0 while(index < 1000){ let code = verificationCode() if(!codes[code]){ codes[code] = index index++ //arr.push(code) } } console.log(codes) //console.log(arr.length) }
最后推荐一篇文章前端面试考点多?看这些文章就够了react