diff --git a/src/math/calculation.js b/src/math/calculation.js index efe6b6733e..77d9239750 100644 --- a/src/math/calculation.js +++ b/src/math/calculation.js @@ -473,7 +473,7 @@ p5.prototype.max = function(...args) { const findMax = arr => { let max = -Infinity; for (let x of arr) { - max = x > max ? x : max; + max = Math.max(max, x); } return max; }; @@ -551,7 +551,7 @@ p5.prototype.min = function(...args) { const findMin = arr => { let min = Infinity; for (let x of arr) { - min = x < min ? x : min; + min = Math.min(min, x); } return min; };