-Infinity in javascript | cold tricks

PHOTO EMBED

Thu Apr 18 2024 12:26:33 GMT+0000 (Coordinated Universal Time)

Saved by @gitjck #javascript

x = findMax(1, 123, 500, 115, 44, 88);

function findMax() {
  let max = -Infinity;
  for (let i = 0; i < arguments.length; i++) {
    if (arguments[i] > max) {
      max = arguments[i];
    }
  }
  return max;
}
content_copyCOPY