Edit This Code:
<!DOCTYPE html>
<html>
<body>

<p>How to create a JavaScript object array.</p>

<p id="demo"></p>

<script>
var employees = [
    {
    "firstName":"John",
    "lastName":"Doe"
    },
    {
    "firstName":"Anna",
    "lastName":"Smith"
    },
    {
    "firstName":"Peter",
    "lastName":"Jones"
    }
];
document.getElementById("demo").innerHTML =
employees[0]["firstName"] + " " + employees[0]["lastName"];
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy