The web development movement has been gathering pace for the last 4 – 5 years with various technologies battling to gain dominance.
We’ve seen everything from battles between MVVM vs MVC, Object orientated programming vs procedural, Rails vs Grails, Java vs the world and of course the mudslinging. The biggest victims of this being JavaScript and Flash.
Both JavaScript and Flash have come under prolonged attack, recently from CoffeeScript and Flash from everyone, including its creators.
Today we are going to look at how JavaScript is surviving and adapting to its critics, with the announcement of ECMAScript 6 (the foundation of JavaScript).
Let
LET creates a variable that is limited to the block it is created in. Great – a chance to avoid some of those pesky JavaScript scoping bugs
Default arguments
ECMAScript 6 is going to allow you to specify default argument values e.g.
function (myArg = 'hello', myOtherArg = 'world) {
return myArg+myOtherArg;
}
I see a reduction in undefined errors
Multi-line strings
A simple but awesome addition, using the ` character we should be able to create a variable string that spans multiple lines e.g.
var myString = `This is my chunk of text`;
Without having to start throwing in hideous linebreaks everywhere, it’ll be interesting to see how minification scripts handle this.