JSFiddle - React, Tailwind, and code Playground

HTML

<p id="3"></p>
    <button id="myButton">click me</button>

JavaScript

var ObjectArray = function() {
        // object literal
        var id1 = {
            firstName: "John",
            lastName: "Doe",
            id: "12345"
        };

        // keyword new
        var id2 = new Object;
        id2.firstName = "Adam";
        id2.lastName = "Bakely";
        id2.id = "abcdef";

        // object constructor 
        function employee(first, last, id_num) {
            this.firstName = first;
            this.lastName = last;
            this.id_num = id_num;
        }
        var id3 = new employee("joe", "john", "abc123");

        //create an array
        var IdArray = [id1, id2, id3];

        //for loop to display results
        var text="";
        var i;

        for (i = 0; i < IdArray.length; i++){
            text += IdArray[i].firstName + "<br>";
        document.getElementById("3").innerHTML = text;
        }  
}

document.querySelector('#myButton').addEventListener('click', ObjectArray);