Skip to content

Commit

Permalink
max and min now evaluates correctly
Browse files Browse the repository at this point in the history
max and min now evaluates correctly  even on numbers in strings
  • Loading branch information
iamnithishraja committed Jan 12, 2024
1 parent b9d037b commit 328b523
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/math/calculation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down Expand Up @@ -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;
};
Expand Down

0 comments on commit 328b523

Please sign in to comment.