Answers for "how to display objects from an array in javascipt"

0

how to display objects from an array in javascipt

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>JavaScript print array</title>
  </head>
  <body>
    <pre id="arrPrint"></pre>
    <script>
      let arr = [{name: "Jack"}, {name: "John"}, {name: "James"}];
      document.getElementById("arrPrint").innerHTML = JSON.stringify(arr, null, 2);
    </script>
  </body>
</html>
Posted by: Guest on July-04-2021
0

how to display objects from an array in javascipt

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>JavaScript print array</title>
  </head>
  <body>
    <pre id="arrPrint"></pre>
    <script>
      let arr = ["Jack", "John", "James"];
      document.getElementById("arrPrint").innerHTML = arr;
    </script>
  </body>
</html>
Posted by: Guest on July-04-2021

Code answers related to "how to display objects from an array in javascipt"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language