Answer the question
In order to leave comments, you need to log in
How to sort the new array?
Good afternoon!
Can you tell me how to add a new array element to an array and sort all the elements of the new array?
It is possible both on ES5, ES6, and on jQuery.
Answer the question
In order to leave comments, you need to log in
So what?
const arr = [4, 63, 3, 87];
console.log(arr.sort((a, b) => a - b));
arr.push(2);
console.log(arr.sort((a, b) => a - b));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question