June 2018
Intermediate to advanced
348 pages
8h 19m
English
This version arrives with significant changes in the language syntax. Let's review the new features and compare with the ES5 syntax.
In ES5, to make a near representation of an object in JavaScript, we commonly type something like this:
function Person(name, age) { this.name = name; this.age = age;}Person.prototype.sayHi = function() { return 'Hi, my name is ' + this.name + ' and i have ' + this.age + ' years old';}var Erikson = new Person('Erikson', 26);Erikson.sayHi(); // 'Hi, my name is Erikson and i have 26 years old'
If we want to improve our code, maybe we can do some refactoring, as follows:
function Person(name, age) { this.name = name; this.age = age; this.sayHi = function () { return 'Hi, my name is ' + this.name + ' and i ...
Read now
Unlock full access