I'm new to javascript.
I'm trying to debug the simple program:
console.log("Hello World!\n"); // this line has a breakpoint
let million = 1_000_000;
console.log(million);
However, when I press the play button in the debug section, I get:
Process exited with code 1
Uncaught SyntaxError SyntaxError: Invalid or unexpected token
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Module._load (internal/modules/cjs/loader.js:585:3)
at Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
Most likely node.js hasn't implemented the "_" notation for numbers. Despite that, the error message I'm seeing seems more like messages from a bad build from C++ (we even get a code error 1), than a bad script in a higher level.
Is there a way to make this output more like a higher level language, like python, where with the traceback would point us to the file and line of the error? Also, why is it that the debugger is not stopping at the breakpoint?
P.S.: When a press the dropdown arrow in the debug terminal, I get the message No debugger available, can not send 'variables'.
Well, to solve this issue, I had to create a launch.json file (not sure how), and then I added "console": "integratedTerminal" to it.
So, when we launch the program, in the integrated vscode terminal we'll get the error message with some extra information:
let million = 1_000_000;
^
After solving this error, the debug will work almost as expected, except for the behaviour of the step-into button.