Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
toFixed solution in Clear category for The Most Numbers by Sim0000
import assert from "assert";
function mostNumbers(...a: number[]): number {
return a.length && +(Math.max(...a) - Math.min(...a)).toFixed(3);
}
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. 12, 2020