Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
every solution in Clear category for Ascending List by Sim0000
import assert from "assert";
function isAscending(values: number[]): boolean {
return values.every((item, i) => i == 0 || values[i - 1] < item);
}
console.log('Example:');
console.log(isAscending([-5, 10, 99, 123456]));
// These "asserts" are used for self-checking
assert.equal(isAscending([-5, 10, 99, 123456]), true);
assert.equal(isAscending([99]), true);
assert.equal(isAscending([4, 5, 6, 7, 3, 7, 9]), false);
assert.equal(isAscending([]), true);
assert.equal(isAscending([1, 1, 1, 1]), false);
console.log("Coding complete? Click 'Check' to earn cool rewards!");
May 4, 2020
Comments: