Advertisement
Liliana797979

04.negative/positive numbers

Sep 18th, 2021
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(arr) {
  2.     const result = [];
  3.  
  4.     for (let num of arr) {
  5.         if (num < 0) {
  6.             result.unshift(num);
  7.         } else {
  8.             result.push(num);
  9.         }
  10.         for (let num of result) {
  11.         }
  12.        
  13.     }
  14.     console.log(result);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement