- Use Node built-in debugger by putting statements into a given script to find a problem by using debugger
- Launch debugger
- Fix the script
You've been hired by a major national bank to fix some of their account creation code. They had some bad developers in the past that left some bugs in the code. Your job is to fix all the issues and get the code functional again.
In this lab, you'll debug a Node script which has an issue.
- Open
account.js
then launch it from a command line withnode account
. - Notice some issues (there a few of them)
- Put some
debugger
statements inaccount.js
- Launch in debug mode with
node debug account
- Track issue
- Fix the file. Hint: there are 3 issues to fix.
- Run test with
npm test
The fixed script should output the following:
Account before opening: { balance: 0, name: 'Azat Mardan', checking: '1' }
New balance after signup bonus is 250
Account after opening: { balance: 1250,
name: 'Azat Mardan',
checking: '1',
type: 'checking' }
View node-debugger-lab on Learn.co and start learning to code for free.