Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for The Most Numbers by mortonfox
import assert from "assert";
function mostNumbers(...numbers): number {
return numbers.length === 0 ? 0 : Math.round((Math.max(...numbers) - Math.min(...numbers)) * 1000) / 1000;
}
console.log('Example:');
console.log(mostNumbers(1, 2, 3));
// These "asserts" are used for self-checking
assert.equal(mostNumbers(1, 2, 3), 2);
assert.equal(mostNumbers(5, -5), 10);
assert.equal(mostNumbers(10.2, -2.2, 0, 1.1, 0.5), 12.4);
assert.equal(mostNumbers(), 0);
console.log("Coding complete? Click 'Check' to earn cool rewards!");
Aug. 13, 2020