Search code examples
javascriptnode.jsejs

I can't reach my page on localhost when I define a new variable on my app.js file


[enter image description here](https://i.sstatic.net/jgD0e.png)

Hi, When I try to define the variable const items = []; My localhost refuse to connect. I get ERR_CONNECTION_REFUSED. or (This site can't be reached). When I comment out the the line where I've declared the variable, the site works.

Does anybody have an idea about why?

My firewall is off and I disabled all proxies. But nothing.


Solution

  • You didn't pass the variable to the template screenshot of the code

    You should do this instead:

    res.render("list", { dayWeek: day, newListItem: items });