- 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. Some bugs have crept into the code (as bugs are wont to do). Your job is to fix the issues and make the code functional again.
In this lab, you'll debug a Node script which has some issues.
- Open
account.js
then launch it from the command line withnode account
. - Find the issues
- Put some
debugger
statements inaccount.js
- Launch in debug mode with
node debug account
- Track the issues
- Fix the file. (Hint: there are 3 issues to fix.)
- Run test with
npm test
Note: In order to debug the exported function in account.js
, you'll need
to call the function somewhere in that file. Simply add a call to account()
at
the bottom of the file and your break statements should work. Remove this call
before running the tests.
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.