SHARE
TWEET

Untitled

a guest May 16th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Küçükten büyüğe göre sıralamak için
  2. var numbers = [4, 2, 5, 1, 3];
  3.  
  4. numbers.sort(function(a, b) {
  5.   return a - b;
  6. });
  7.  
  8. console.log(numbers);
  9. // [1, 2, 3, 4, 5]
  10.  
  11. // Büyükten büyüğe göre sıralamak için
  12. var numbers = [4, 2, 5, 1, 3];
  13.  
  14. numbers.sort(function(a, b) {
  15.   return b - a;
  16. });
  17.  
  18. console.log(numbers);
  19. // [5, 4, 3, 2, 1]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top