Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sorting_numbers(current_arr) {
- current_arr.sort();
- let sorted_arr = [];
- while (current_arr.length > 0) {
- let first_element = current_arr.shift();
- let last_element = current_arr.pop();
- sorted_arr.push(first_element);
- sorted_arr.push(last_element);
- }
- console.log(sorted_arr);
- }
- sorting_numbers([1, 65, 3, 52, 48, 63, 31, -3, 18, 56])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement