I'm currently heading for Coursera and doing an exercise using node.js code to compute a quadratic expression. All the code is listed, and this exercise is just to introduce us to node.js, but still I ran into a problem that comes in the invitation.
the code is here:
var quad = require('./quadratic'); var prompt = require('prompt'); prompt.get(['a', 'b', 'c'], function (err, result) { if (err) { return onErr(err); } console.log('Command-line input received:'); console.log('a: ' + result.a); console.log('b: ' + result.b); console.log('c: ' + result.c); quad(result.a,result.b,result.c, function(err,quadsolve) { if (err) { console.log('Error: ', err); } else { console.log("Roots are "+quadsolve.root1() + " " + quadsolve.root2()); } }); });
As you can see, I use the prompt module, but when I enter the input for a , cmd skips the input for b and asks me to enter `c, which in turn is couse, which leads to an error.

How to solve this problem and why is this happening?
source share