Advertisement
Guest User

Untitled

a guest
Sep 11th, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. let arr = ["HTML", "JavaScript", "CSS"];
  2.  
  3. function copySorted(arr) {
  4. return arr.slice().sort(); // kopiuje, sortuje
  5. }
  6.  
  7. let sorted = copySorted(arr);
  8.  
  9. console.log(sorted); // CSS, HTML, JavaScript
  10. console.log(arr); // HTML, JavaScript, CSS (no changes)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement