How do I compare values of spread argument with some value?
For example:
var arr = [1, 4, 10];
if(Math.min(...arr) > 1) {
console.log('Must be greater than 1');
}
is giving me undefined
. Naturally same with Math.max(...arr)
.
Same happens if I do:
var val = Math.min(...arr);
and then compare variable with some value.
Why?