Node Debugger Lab

Objectives

  1. Use Node built-in debugger by putting statements into a given script to find a problem by using debugger
  2. Launch debugger
  3. Fix the script

Introduction

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.

Instructions

  1. Open account.js then launch it from the command line with node account.
  2. Find the issues
  3. Put some debugger statements in account.js
  4. Launch in debug mode with node debug account
  5. Track the issues
  6. Fix the file. (Hint: there are 3 issues to fix.)
  7. 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.

Unlock your future in tech
Learn to code.

Learn about Flatiron School's Mission

With a new take on education that falls somewhere between self-taught prodigy and four-year computer science degree, the Flatiron School promises to turn students with little programming experience into developers.

In the six months since the Manhattan coding school was acquired by WeWork, it has spawned locations in Washington, D.C., Brooklyn, and London. Now, WeWork is opening a fourth Flatiron School location, this time in Houston.

Adam Enbar, Flatiron School's cofounder, believes now is the time to grow. "How the world is changing has impacted working and learning in very similar ways. We think education fundamentally is about one thing: enabling people to pursue a better life."

Learn. Love. Code.
Students come to Flatiron School to change their lives. Join our driven community of career-changers and master the skills you need to become a software engineer or a data scientist.
Find Us