Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Ascending List by vvm70
import assert from "assert";
function isAscending(values: number[]): boolean {
return values.join() === [...(new Set(values))].sort((a, b) => a - b).join();
}
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!");
Dec. 3, 2020
Comments: