var increment = function() {
return [1,2,3,4,5].map(function(num) {
return num + 1;
});
};
Moreover, modern JS is not merely convenient syntactic sugar over old JS. Let/const have different scopes, arrow functions have no bindable context.You also now have classes, proxies, async/await, generators, destructuring, default/rest/spread parameters, ...
Add typing via jsdocs or TypeScript and - like the parent comment said - "it's really nice".
Often people mistake JS for a mere DOM manipulation language and think of
document.getElementById('myDiv').innerHTML = 'Hello World';
instead of what it has become today.I still hate it though for sorting arrays with only number types lexically:
[1,2,10,20].sort(); //[1,10,2,20]