

We can use the "import" or "export" statement in a module to import or export variables, functions, classes or any other component from/to different files and modules. ES6 introduced a new feature called modules, in which each module is represented by a separate ".js" file. Previously, there was no native support for modules in JavaScript.

Obj.getName() // output: The Full-Name is John Smith Let obj = new UserProfile('John', 'Smith') But, the "let" variables and constants have block scope which is surrounded by curly-braces "`) It means that a variable can be used before declaration. Variables were previously declared using "var" which had function scope and were hoisted to the top. The keyword "let" enables the users to define variables and on the other hand, "const" enables the users to define constants. In this article, we will discuss some of the best and most popular ES6 features that we can use in your everyday JavaScript coding. It brought several new features like, let and const keyword, rest and spread operators, template literals, classes, modules and many other enhancements to make JavaScript programming easier and more fun. It defines the standard for the implementation of JavaScript and it has become much more popular than the previous edition ES5.ĮS6 comes with significant changes to the JavaScript language. ES6 or the ECMAScript 2015 is the 6th and major edition of the ECMAScript language specification standard.
