Top ES6 Interview Questions, ECMAScript 2015 Interview Questions

1. What is ES6?

Es6 or ECMASCRIPT 2015 is sixth major release of ECMAScript language which comes with a lot of new features and syntax for writing web applications in javascript. As currently, not all browsers support ES6, they support pre-versions of ES6.SO to write web applications in ES6 that will support all Browsers we needed tools like Babel and Webpack.

12. List some new features of ES6

New Features in ES6.

Support for constants (also known as “immutable variables”)

Block-Scope support for both variables, constants, functions

Arrow Functions

Extended Parameter Handling

Template Literals

Extended Literals

Enhanced Regular Expression

Enhanced Object Properties

Destructuring Assignment

Modules, Classes, Iterators, Generators

Support for Map/Set & WeakMap/WeakSet

Promises, Meta-Programming ,Internationalization & Localization

Read More from http://es6-features.org/

13. What is Babel?

Babel is one of the most popular javascript transpilers and becomes the industry standard. It allows us to write ES6 code and convert it back in pre-Es6 javascript that browser supports.

In order to install Babel, you require node.js and NPM. Make sure Node.js is installed on your server.

To check node installed or not run below commands on your terminal.

node -v
npm -v

Installing Babel

We can install Babel CLI locally by running below command on terminal.

npm install --save-dev babel-cli

15. What is Webpack?

Webpack allows you to run an environment that hosts babel.Webpack is opensource javascript module bundler which takes modules with dependencies and generates static assets representing those modules.

16. List benefits of using Webpack?

Benefits of using Webpack.

It bundles your multiple modules and packs it into a single .js file.

It comes with integrated dev server. A small express app for local development.You simply include one Javascript tag pointed to the server, like localhost:8080/assets/bundle.js, and get live code updating and asset management for free.

17. Explain Constants in Es6?

Constants also are known as immutable variables are a special type of variables whose content is not changed. In Es6 a constant is defined using const keyword.Constants in Es6 enable protection to overwrite a variable value, improve performance and helps programmers to write readable and cleaner code.

Template literals are the string with embedded code and variables inside.Template literal allows concatenation and interpolation in much more comprehensive and clear in comparison with prior versions of Ecma script.