by factor. function scale(factor, point) { return point.map(function (coord) { return factor * coord; }); } // ES2015: Destructuring the returned value from a function call: const [x, y, z] = scale(7, [2, 3]); // x === 7 * 2 // y === 7 * 3 // typeof z === 'undefined' /* “fail-soft” like array index */ var scaled = scale(7, [2, 3]); // scaled[0] === 7 * 2 && scaled[1] === 7 * 3 && scaled.length === 2