HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <h1>JSON sort reverse</h1> <p>Sort the objects in the array in reverse order.</p> <button onclick="myFunction()">Click Me</button> <script> var data = [ { "name": "Danny", "age": 25 }, { "name": "Mike", "age": 35 }, { "name": "Jade", "age": 18 } ] function myFunction(){ console.log(data.reverse()); } </script> <p><strong>Note</strong>: Click on the button and check your console</p> </body> </html>
OUTPUT
×

Save as Private