Home  >  Q&A  >  body text

javascript - Debugging code with vs code, 'window is not defined' appears

Is this due to a problem with node running locally or some other reason? I read some similar questions but couldn't find a solution

迷茫迷茫2687 days ago1434

reply all(2)I'll reply

  • 怪我咯

    怪我咯2017-06-12 09:31:15

    Because node is not a browser and does not have a window.

    reply
    0
  • 迷茫

    迷茫2017-06-12 09:31:15

    The global variable window does not exist in node.js.
    Window is a browser specification, not a js language specification, so of course it cannot be used in nodejs.
    However, nodejs has a similar global variable called golgal, but its internal content is very different from the window in the browser.

    reply
    0
  • Cancelreply