/typescript/

TypeScript part 17 (spread)

2017-03-04 16:06:09

TypeScript

const number = [1,2,3,4,88, 90];

console.log(Math.max(1,2,3,4,88, 90));
// console.log(Math.max(number)); <- error
console.log(Math.max(...number));

JavaScript

var number = [1, 2, 3, 4, 88, 90];
console.log(Math.max(1, 2, 3, 4, 88, 90));
// console.log(Math.max(number));<- error
console.log(Math.max.apply(Math, number));