One area that new Node.js developers struggle with is debugging code. Instead of having the inspector, we have a system where the first crash will dump some information to our screen and instantly kick us to the command-line. This can be seen with the following code:
const thing = 'this';
console.log(thing);
thing = 10;
Here, we can see that we are trying to reassign a constant, so Node.js is going to throw an error similar to the following one:
TypeError: Assignment to constant variable.
at Object.<anonymous> (C:\Code\Ch5\bad_code.js:3:7)
at Module._compile (internal/modules/cjs/loader.js:774:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
at Module.load (internal/modules/cjs/loader.js:641:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Function.Module.runMain...