Trouble displaying javascript in HTML

Hello guys, I’m not sure why my code isn’t working and it doesn’t print the date in the browser. Could you please help me?

<!DOCTYPE html>
    <title>Parcel Sandbox</title>
    <meta charset="UTF-8" />
    <script src="src/index.js"></script>

    <script type="text/javascript">
      function myFunction() {
        var today = new Date();
        var date = today.getDay();
        var daylist = [
          "Wednesday ",

        var dayOfTheWeek = daylist[date];

        document.getElementById("myText").innerHTML = dayOfTheWeek;

  <body onload="myFunction()">
    <div id="app"></div>

      Today is
      <script type="text/javascript">

there is no element with such an id

<body onload="myFunction()"> is also very unusual and same goes for

<script type="text/javascript">

I’d recommend you start with a basic JS tutorial. can also help you on how to interact with the DOM (writing from JS to HTML)

1 Like