Advertisement
PawsonCz

Untitled

Sep 12th, 2020
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. let numbers = [3, 444,23,666, 78,13,79]
  2. console.log(numbers)
  3.  
  4. //to zwraca wartości w oczekiwany przeze mnie sposób.
  5. function del () {
  6. let ostatni = numbers.slice(-1);
  7. let pierwsze = numbers.slice(0,2)
  8. let zima = []
  9. zima.push(...ostatni, ...pierwsze)
  10. console.log(zima)
  11. }
  12. del()
  13.  
  14. let nums;
  15. nums = numbers.slice(0,2).concat(numbers.slice(-1));
  16. console.log(`to cudo zwraca liczby w kolejności 'pierwsza, druga, ostatnia`)
  17. console.log(nums)
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement