Guest User

Untitled

a guest
Nov 28th, 2017
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width">
  6. <title>JS Bin</title>
  7. </head>
  8. <body>
  9.  
  10. <script id="jsbin-javascript">
  11. let array = [{"_id":"111111111111111111111111",
  12. "zipcode": "17648sa",
  13. "country": "UAE",
  14. "state": "Dubai",
  15. "city": "testinf",
  16. "phoneNumber": "009715464888797",
  17. "address": "test, test-0989787192, 109283#",
  18. "userName": "alton pereira",
  19. "email": "alton@live.com"},
  20. {"_id":"22222222222222222222222",
  21. "zipcode": "17648sa",
  22. "country": "UAE",
  23. "state": "Dubai",
  24. "city": "testinf",
  25. "phoneNumber": "009715464888797",
  26. "address": "test, test-0989787192, 109283#",
  27. "userName": "alton pereira",
  28. "email": "alton@live.com"},
  29. {"_id":"333333333333",
  30. "zipcode": "17648sa",
  31. "country": "UAE",
  32. "state": "Dubai",
  33. "city": "testinf",
  34. "phoneNumber": "009715464888797",
  35. "address": "test, test-0989787192, 109283#",
  36. "userName": "alton pereira",
  37. "email": "alton@live.com"}
  38.  
  39. ]
  40.  
  41.  
  42. function swap(indexA,indexB){
  43. let a = array[indexA];
  44. let b = array[indexB];
  45. array[indexA] = b;
  46. array[indexB] = a;
  47. return array
  48. }
  49.  
  50. let a = swap(1,2);
  51.  
  52. console.log(a)
  53. </script>
  54.  
  55.  
  56.  
  57. </body>
  58. </html>
Add Comment
Please, Sign In to add comment