Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width">
- <title>JS Bin</title>
- </head>
- <body>
- <script id="jsbin-javascript">
- let array = [{"_id":"111111111111111111111111",
- "zipcode": "17648sa",
- "country": "UAE",
- "state": "Dubai",
- "city": "testinf",
- "phoneNumber": "009715464888797",
- "address": "test, test-0989787192, 109283#",
- "userName": "alton pereira",
- "email": "alton@live.com"},
- {"_id":"22222222222222222222222",
- "zipcode": "17648sa",
- "country": "UAE",
- "state": "Dubai",
- "city": "testinf",
- "phoneNumber": "009715464888797",
- "address": "test, test-0989787192, 109283#",
- "userName": "alton pereira",
- "email": "alton@live.com"},
- {"_id":"333333333333",
- "zipcode": "17648sa",
- "country": "UAE",
- "state": "Dubai",
- "city": "testinf",
- "phoneNumber": "009715464888797",
- "address": "test, test-0989787192, 109283#",
- "userName": "alton pereira",
- "email": "alton@live.com"}
- ]
- function swap(indexA,indexB){
- let a = array[indexA];
- let b = array[indexB];
- array[indexA] = b;
- array[indexB] = a;
- return array
- }
- let a = swap(1,2);
- console.log(a)
- </script>
- </body>
- </html>
Add Comment
Please, Sign In to add comment