Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
... Math max, min solution in Clear category for [old] The Most Numbers by zoezed
"use strict";
const mostNumbers = (...numbers) => {
return numbers.length !== 0 ? Math.max(...numbers) - Math.min(...numbers) : 0;
}
var assert = require('assert');
if (!global.is_checking) {
assert.equal(mostNumbers(1, 2, 3), 2, "3-1=2");
assert.equal(mostNumbers(5, -5), 10, "5-(-5)=10");
assert.equal(Math.round(mostNumbers(10.2, -2.2, 0, 1.1, 0.5)*1000), 12400, "10.2-(-2.2)=12.4");
assert.equal(mostNumbers(), 0, "Empty");
assert.equal(mostNumbers(-0.036,-0.11,-0.55,-64), "63.964")
console.log("Coding complete? Click 'Check' to review your tests and earn cool rewards!");
}
Feb. 3, 2020