js code display array in html code example

Example 1: javascript array read object value in array

var events = [
  {
    userId: 1,
    place: "Wormholes Allow Information to Escape Black Holes",
    name: "Check out this recent discovery about workholes",
    date: "2020-06-26T17:58:57.776Z",
    id: 1
  },
  {
    userId: 1,
    place: "Wormholes Allow Information to Escape Black Holes",
    name: "Check out this recent discovery about workholes",
    date: "2020-06-26T17:58:57.776Z",
    id: 2
  },
  {
    userId: 1,
    place: "Wormholes Allow Information to Escape Black Holes",
    name: "Check out this recent discovery about workholes",
    date: "2020-06-26T17:58:57.776Z",
    id: 3
  }
];
console.log(events[0].place);

Example 2: how to read an array in javascript in HTML5

<body>
  <h1>Creating Arrays</h1>
  <h2>Regular:</h2>
  <script language="JavaScript">
    // Create the array.
    var Colors = new Array();
    // Fill the array with data.
    Colors[0] = "Blue";
    Colors[1] = "Green";
    Colors[2] = "Purple";
    // Display the content onscreen.
    document.write(Colors);
  </script>
  <h2>Condensed:</h2>
  <script language="JavaScript">
    // Create the array and fill it with data.
    var Colors = new Array("Blue", "Green", "Purple");
    // Display the content onscreen.
    document.write(Colors);
  </script>
  <h2>Literal:</h2>
  <script language="JavaScript">
    // Create the array and fill it with data.
    var Colors = ["Blue", "Green", "Purple"];
    // Display the content onscreen.
    document.write(Colors);
  </script>
</body>