In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
The content of this article mainly focuses on how to answer the interview questions of ES6. The content of the article is clear and clear. It is very suitable for beginners to learn and is worth reading. Interested friends can follow the editor to read together. I hope you can get something through this article!
ES6, whose full name is ECMAScript6, can help the JavaScript language become an enterprise development language, writing large and complex applications. ES6 is also a frequent test site in front-end interviews. This article collates and summarizes the ES6-related interview questions and the corresponding reference answers, you can comb through the relevant knowledge points before the interview, with the best state to meet the interview.
1. Talk about promise?
Promise is an asynchronous function, which is mainly generated to solve the problem of asynchronous callback hell (that is, the problem of loop nesting). There are three states: Fulfilled is a successful state, Rejected is a failed state, and Pending is neither a Fulfilld nor a Rejected state. It can be understood as the initial state of the Promise object instance when it is created, and you should know how to write promise.
2. How much do you know about ES6 features? If you come across something that you don't know is ES6 or ES5, how can you tell the difference?
The commonly used new es6 feature: the let & & const;let command is also used to declare objects, but the scope is local; the iterable type. In order to unify the collection type, the ES6 standard introduces a new iterable type. Array, Map and Set all belong to the iterable type. Collections with iterable type can pass the new for. Of loop to traverse. Es6 adds a lot of special methods than es5, and if you encounter these special methods, you can be sure it is es6. If these special methods are not referenced in your code, then we can assume that they are es5. So the premise that you need to understand the syntax of es6 to make a judgment, frequently used features are arrow function, deconstruction assignment, let, const.
3. What is the difference between ES6 inheritance and ES5 inheritance?
The inheritance of es5 is realized through the prototype or constructor mechanism. Es6 has used the class keyword to define the class, in which there are construction methods, the classes are implemented by the extends keyword, and the subclasses must call the super method in the constructor method.
4. The advantages of let and const?
Let and const have block-level scope, and variable declarations are not improved compared to var.
5. What is ES6 generator and the principle of async / await implementation?
The generator function is an encapsulated asynchronous task, that is, the container of the asynchronous task. Executing the Generator function will return an ergodic object. The implementation of the async function is to wrap the Generator function and the automatic executor in a function.
6. The difference of commonjs modularization specification between ES6 and node.
ES6 is an enhanced version of Js and the syntax specification of Js. Commonjs is only to solve the problem of dependency and reference between Js files, so it is a package management specification of Js, in which the representative is that Node follows the commonjs specification.
7. Arrow functions, and their this.
The so-called arrow function is very easy to write and compared with before, similar to: (A returna+b; b) = > {arrow}, the this of the arrow function points to the object in which it is defined by default, rather than the object at the time of execution, and when defining it, the environment may be window (that is, inheriting the parent this).
Thank you for your reading. I believe you have a certain understanding of the question "how to answer the interview questions of ES6". Go ahead and practice it. If you want to know more about it, you can follow the website! The editor will continue to bring you better articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.