I am new to TypeScript and I am trying following
const storedNumber = [1,2,3,4,5];
Math.max(storedNumber)
but I kept typescript error saying
argument of type 'any ' is not assignable to parameter of type number
I am new to TypeScript and I am trying following
const storedNumber = [1,2,3,4,5];
Math.max(storedNumber)
but I kept typescript error saying
argument of type 'any ' is not assignable to parameter of type number
Math.max
requires numbers as arguments like Math.max(1, 3, 2)
not an array. You can spread
the array.
const storedNumber = [1,2,3,4,5];
console.log( Math.max(...storedNumber) );
Doc: Math.max(), Spread