For example, how do I achieve the following without iterating over the array?
var a = [1, 2, 3] * 5; // a should equal [5, 10, 15]
In ECMAScript 6, you can use arrow functions:
var a = [1, 2, 3];
var b = a.map(x => x * 5); // <-------
console.log(b); // [5, 10, 15]
Arrow functions are syntactic sugar for an inline function with lexical this
binding:
// ES6
let array2 = array1.map(x => x * 5);
// ES5
var array2 = array1.map((function (x) { return x * 5; }).bind(this));
Therefore, if you need to support Internet Explorer or other old browsers (Edge understands ES6) you can use babeljs or TypeScript in your project to cross-compile your code to ES5 syntax.