Reputation: 4466
I'm working on the following nodejs javascript code. I am subtracting two valid numbers from each other and receiving NAN as a result.
Any clues why this is?
stringLength = process.stdout.colums - "Spaces: aa".length;
console.log(process.stdout.columns); //returns 80
console.log("Spaces: aa".length); //returns 10
console.log(eval(process.stdout.colums - "Spaces: aa".length)); //returns NAN
console.log(stringLength); //returns NAN
Thanks for the help.
Upvotes: 0
Views: 724
Reputation: 123739
I think its the typo (colums
v/s columns
) that is causing the issue.
process.stdout.colums - "Spaces: aa".length; // undefined - 10 = NaN | Always, not even Evil (eval) can help
should be
process.stdout.columns - "Spaces: aa".length;
Upvotes: 4