mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 07:07:23 +00:00
Address the FIXME in MathObject::max to handle an arbitrary number of arguments. Also adding a test case to verify the behavior of Math.max() while I'm here.
15 lines
323 B
JavaScript
15 lines
323 B
JavaScript
function assert(x) { if (!x) throw 1; }
|
|
|
|
try {
|
|
assert(Math.max.length === 2);
|
|
assert(Math.max(1) === 1);
|
|
assert(Math.max(2, 1) === 2);
|
|
assert(Math.max(1, 2, 3) === 3);
|
|
assert(isNaN(Math.max(NaN)));
|
|
assert(isNaN(Math.max("String", 1)));
|
|
|
|
console.log("PASS");
|
|
} catch {
|
|
console.log("FAIL");
|
|
}
|