Guest User

Untitled

a guest
Jun 22nd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. for (var i = 0; i < 10; i++) {
  2. var ndwi_test = ee.Number(ee.Dictionary(s2_ndwi_mean.get(i)).get('NDWI')).float()
  3. ndwi_array.push(ndwi_test)
  4. }
  5.  
  6. ndwi_array= ee.Array(ndwi_array).sort()
  7.  
  8. cars = [
  9. {
  10. name: "Honda",
  11. speed: 80
  12. },
  13.  
  14. {
  15. name: "BMW",
  16. speed: 180
  17. },
  18. ]
  19.  
  20.  
  21. cars.sort(function(a, b) {
  22. return a.speed - b.speed;
  23. })
  24.  
  25. var a = [[12, 'AAA'], [58, 'BBB'], [28, 'CCC'],[18, 'DDD']];
  26.  
  27. a.sort(sortFunction);
  28.  
  29. function sortFunction(a, b) {
  30. if (a[0] === b[0]) {
  31. return 0;
  32. }
  33. else {
  34. return (a[0] < b[0]) ? -1 : 1;
  35. }
  36. }
Add Comment
Please, Sign In to add comment