HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <h1>JSON Basic Program</h1> <p id="point"></p> <button onclick="myFunction()">Click Me</button> <script> var data = [ { name: "Mike", age: 36}, { name: "Alex", age: 30} ]; function myFunction(){ document.getElementById("point").innerHTML = data[1].name; } </script> <p><strong>Note</strong>: Click on the button to get the name from JSON.</p> </body> </html>
OUTPUT
×

Save as Private