August 2016
Intermediate to advanced
635 pages
14h 5m
English
We've seen so far that it is perfectly possible to build classes and even modules in pre ECMAScript -2015 JavaScript. The syntax is, obviously, a bit more involved than in a language such as C# or Java. Fortunately ECMAScript-2015, brings support for some syntactic sugar for making classes:
class Castle extends Westeros.Structures.BaseStructure {
constructor(name, allegience) {
super(name);
...
}
Build() {
...
super.Build();
}
}ECMAScript-2015 also brings a well thought out module system for JavaScript. There's also syntactic sugar for creating modules which looks like this:
module 'Westeros' {
export function Rule(rulerName, house) {
...
return "Long live " + rulerName + " of house " + house;
}
}As modules can ...