Which fix removes the bug?
const max = Math.max([4, 9, 1]);
- Use
Math.maximum - Use
Math.max.apply([4,9,1]) - Sort the array first
- Use
Math.max(...[4, 9, 1])
Math.max takes individual args; spread the array.const max = Math.max([4, 9, 1]);
Math.maximumMath.max.apply([4,9,1])Math.max(...[4, 9, 1])Math.max takes individual args; spread the array.