Reputation: 55
I am starting to code JavaScript on JetBrains WebStorm, and I am trying to follow a few examples from a book. I am trying to avoid adding use-strict
at the start of every code file, knowing fully that using this approach should be used with caution.
When I use a console with node --use-strict
(with the flag) and execute the following line:
coutner = 1
I get the expected error: Uncaught ReferenceError: coutner is not defined.
Then I try using the Run/Debug configuration:
First, I define a new Run/Debug configuration that uses the same node as before, with a node parameter --use-strict
:
Then I execute a file composed of the above code (with or without adding another line: console.log(coutner)
after it) using that run configuration, the code executes, and I am not getting the expected error. Why is that?
I've also added the "Non-strict mode used" inspection under Settings -> Editor -> Inspections, and I get no warning for the file mentioned above.
In addition, I am using WebStorm on a Windows 11 computer and Ubuntu-22.04 through WSL2. These examples don't work on both Windows and Ubuntu node.js interpreters.
Any help would be much appreciated.
Upvotes: 0
Views: 355