Interview questions 1、说说 es6 中的 class(腾讯、滴滴) 2、JSONP 原理(字节) 3、说说对 OOP 的理解(腾讯、字节) 4、 instanceof 原理(百度、滴滴、58、同花顺) 5、 实现 instanceof 的 polyfill(小米) 6、了解哪些设计模式(猿辅导) 7、说一下 new 创建实例的时候都做了什么(滴滴、字节) 8、 浅拷贝...
六、 es6整体理解 请参考深入理解ES6系列文章。 参考链接: http://blog.poetries.top/FE-Interview-Questions/base/#_86-%E8%B0%88%E8%B0%88%E5%8F%98%E9%87%8F%E6%8F%90%E5%8D%87%EF%BC%9F https://blog.csdn.net/ZxxSteven/article/list/1?
写一个方法 isInterger(x),可以用来判断一个变量是否是整数。 ES6 中自带了Number.isInteger()方法。但是目前 ES5 中没有自带的方法,可以把一个数去掉小数点后和原数进行比较,判断是否相等,那么问题就演变成如何对一个数进行取整了。 vara = -1.2223;console.log(a ^0);// -1console.log(a |0);// -1...
Babel: 将ES6编译到ES5 Traceur:将ES6,ES7等编译到ES5 来源: You Don’t Know JS, Up &going Q22: this关键字如何工作?请提供一些例子 话题: JavaScript难度: ⭐⭐⭐⭐ 在JavaScript中,this总是指向函数的“拥有者”(也就是指向该函数的对象),或则拥有该函数的对象。 function foo() { console.log(...
英文| https://betterprogramming.pub/100-javascript-interview-questions-58e22e30f7f1 翻译| 杨小二 接上篇《100 个 JavaScript 面试题和答案(上)》的内容,今天开始后面50道JavaScript面试题。 51、promise中的race方法是什么意思? Promise.race() 方法返回首先解决...
ES6 classes don't fundamentally change JavaScript's inheritance model. They provide a cleaner, more familiar syntax on top of prototypes. class Animal { constructor(name) { this.name = name; } makeSound() { return "Some sound"; } // Static methods belong to the class itself, not ...
第一个和第二个的输出不难判断,在 ES6 之前,JavaScript 只有函数作用域,所以 func 中的 IIFE 有自己的独立作用域,并且它能访问到外部作用域中的 self,所以第三个输出会报错,因为 this 在可访问到的作用域内是 undefined,第四个输出是 bar。如果你知道闭包,也很容易解决的:(function(test) { consol...
Advanced JavaScript coding includes various complex concepts and techniques. Such key concepts are often tested in JavaScript interviews. Some of the concepts are – closure and scope, prototypal inheritance, functional programming, design patterns, memory management, ES6+ features, and many more.1...
类继承:实例继承自类(如蓝图——类的描述),并创建子类关系:层次类分类法。实例通常通过带有“new”关键字的构造函数实例化。类继承可能会也可能不会使用ES6 中的class关键字。原型继承:实例直接从其他对象继承。实例通常通过工厂函数或Object.create() 实例化。实例可以由许多不同的对象组成,允许简单的选择性...
类继承可能会也可能不会使用ES6 中的class关键字。 原型继承:实例直接从其他对象继承。实例通常通过工厂函数或Object.create() 实例化。实例可以由许多不同的对象组成,允许简单的选择性继承。 在JavaScript 中,原型继承比类继承更简单、更灵活。 函数式编程与面向对象编程的优缺点是什么? OOP优点:容易理解对象的基本...