Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
var arr = [100, 1000, 10000, 30000];
var res = [];
arr.forEach((value, key) => {
res.push((key
? (arr[key-1] + " - " + value)
: ("< " + value)));
if (key === (arr.length-1))
res.push("> " + value);
});
console.log(res);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question