Introduction
JavaScript is a language of the Web. This series of articles will talk about my observations learned during my decade of software development experience with JavaScript.
Before moving further let us look at the previous articles of the series:
- Voice of a Developer: JavaScript Data Types - Part One
- Voice of a Developer: JavaScript Objects - Part Two
- Voice of a Developer: JavaScript Engines - Part Three
- Voice of a Developer: JavaScript Common Mistakes - Part Four
- Voice of a Developer: Editors - Part Five
- Voice of a Developer: VSCode - Part Six
- Voice of a Developer: Debugging Capabilities of VSCode - Part Seven
- Voice of a Developer: JavaScript OOP - Part Eight
- Voice of a Developer: JavaScript Useful Reserved Keywords - Part Nine
- Voice of a Developer: JavaScript Functions - Part Ten
- Voice of a Developer: JavaScript Functions Invocations - Part Eleven
- Voice of a Developer: JavaScript Anonymous Functions - Part Twelve
- Voice of a Developer: JavaScript Pure And Impure Function - Part Thirteen
- Voice of a Developer: JavaScript Closures - Part Fourteen
- Voice of a Developer: JavaScript Currying - Part Fifteen
- Voice of a Developer: JavaScript Chaining - Part Sixteen
- Voice of a Developer: JavaScript Array Methods - Part Seventeen
- Voice of a Developer: JavaScript ECMAScript 6 - Part Eighteen
- Voice of a Developer: JavaScript ECMAScript 6 Features v1 - Part Nineteen
In the last article, we learned about ECMAScript 6 features and now we will learn some more cool features.
- Default valuesWe can add default values to function expressions. In ES5, the default value is undefined if the value is not passed via argument. Example ES5.In ES6 we will change it to,
- function coordinates(x, y)
- {
- console.log(x);
- console.log(y);
- }
- coordinates(10); // 10 undefined
- function coordinates(x=10, y=20)
- {
- console.log(x);
- console.log(y);
- }
- coordinates(10); //10 20
- Modules
This is the feature I like the most! We need to define each module in a file then export keyword to export. On the receiving side, we use import keyword to import. This modular approach is a really good solution for code reusability and abstraction.Modules are designed around the export & import keywords.

- Classes
This is a favorite keyword of OOPS developers but JavaScript is prototypal based and function is a first-class citizen in JavaScript. Introducing classes in ES6 is debatable and many people have notion that it is not in favor of JavaScript prototypal nature.Leaving aside, we can understand what lies in this feature.Like OOPS programming languages, classes in ES6 are revolving around class & constructor. Example,Inheritance
- class Automobile
- {
- constructor(type)
- {
- this.type = 'bike';
- this.engine = '150 CC';
- }
- getEngine()
- {
- return this.engine;
- }
- }
- var vehicle = new Automobile('Honda');
- console.log(vehicle.getEngine()); // 150 CC
Use extends keyword for an inheritance to inherit from the base class. Example- class LogView extends View
- {
- render()
- {
- var compiled = super.render();
- console.log(compiled);
- }
- }
- class LogView extends View {}
- Multi-line Strings
It’s a sugar syntax to cut long
- var s = 'hello '
- + 'world';
- console.log(s);
Rajib Das GuptaPosted Jun 8, 2016, 6:37 AM
Good Article
Kuppurasu NagarajPosted May 17, 2016, 11:18 AM
Nice sharing..
Sonu ChaudharyPosted May 16, 2016, 3:27 PM
good one...
Upendra Pratap ShahiPosted May 16, 2016, 6:22 AM
Nice share...
Vipin TyagiPosted May 16, 2016, 4:37 AM
Hi Sumit Jolly Sir,Is it same as Mozilla Scratchpad .Also, I'm not able to run and debug my C# console application in VSCode.Help Needed!
Guest UserPosted May 16, 2016, 2:45 AM
Hi Viipiin Tyagi I am using VSCode .. and in google Chrome I am using ScratchPadJS
Vipin TyagiPosted May 16, 2016, 2:24 AM
I think its title missing Part nineteen as compare to V1 and V2
Vipin TyagiPosted May 16, 2016, 2:22 AM
What a series? This is really informative. Which editor you are using for ECMAScript 6.Sumit Jolly Sir.
Debasis SahaPosted May 16, 2016, 12:58 AM
Nice one..
Guest UserPosted May 15, 2016, 7:57 PM
Thanks Prasanna
Prasanna MuraliPosted May 15, 2016, 3:21 AM
Nice one...