I noticed Node and Chrome allow const so it got me looking into some other new features in the pipe. Turns out Firefox now supports most of this.Constants:const A_CONSTANT = 1; // reassignment doesn't workDestructuring:[a, b] = [1 ,2] //var a = 1, b = 2Block Scoping:if(1) { let x = 1; } // typeof x === 'undefined';Generators & Lazy Evaluation:function* one() { yield 123; return 1;} var generator = one(); generator.next(); // 123generator.next(); // 1List Comprehensions:var colorArr = [{color:'blue'}, {color:'red'}];var yieldsFromGenerator = [x for(x of generator())]; // [ 123 ]var filteredRed = [x for(x of colorArr) if(x.color =='red')] // only contains red itemLooks like JavaScript sucks infinitely less now. Hopefully those features make it into the wild by years end. https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/1.7#Using_JavaScript_1.7[Edited on February 5, 2014 at 12:27 PM. Reason : a]
2/5/2014 12:25:12 PM
[code]PUT CODE HERE[/code]
2/5/2014 4:13:55 PM
I can barely wait for it to support goto
2/5/2014 4:33:52 PM
Constants:
const A_CONSTANT = 1; // reassignment doesn't work
[a, b] = [1 ,2] //var a = 1, b = 2
if(1) { let x = 1; } // typeof x === 'undefined';
function* one() { yield 123; return 1;} var generator = one(); generator.next(); // 123generator.next(); // 1
var colorArr = [{color:'blue'}, {color:'red'}];var yieldsFromGenerator = [x for(x of generator())]; // [ 123 ]var filteredRed = [x for(x of colorArr) if(x.color =='red')] // only contains red item
2/5/2014 4:49:48 PM
Wouldn't block scoping break a bunch of existing JS code?
2/6/2014 12:51:58 AM
Block scoping is possible by using let, which was new to JS 1.7. All blocks are not scoped. That would be... insane.
2/6/2014 9:13:39 AM
btttI want to conquer it ASAP to make some money.
5/30/2014 2:33:34 PM
Keep in mind that "JavaScript 1.7" and so on refer to Mozilla's implementation of the language, which has some extensions not in the ECMAScript standard and therefore not expected to be implemented by other browsers (although some of them are); with that said, everything listed in the OP is also in the soon-to-be-ratified ES6 standard, and you can see which browsers support each new feature here: https://kangax.github.io/compat-table/es6/The site also has tables for ES5 and the non-standard features of various JS engines, and for more general info. on compatibility with features of the Web platform, look here: http://caniuse.com/
6/1/2014 8:14:25 AM