In the following code my false condition doesn't work, I have made sample program:
const path = require("path");
const fs = require("fs");
module.exports = async function(callback)
{
try {
let keywordStr = '11 = cccc = (bbbb sssss )= ttttttttt("")';
let words = keywordStr.split(' '); //number of lines in file
for (let i = 0; i <words.length; i++) {
word= words[i]
console.log("word =" + word)
//NaN = not a number
if (isNaN(word) === false && word !== null){//if(isNaN(word)==false && word !== null){
console.log("testing2 new numeric string = " + word);
}
}
}
catch (error) {
console.log(error)
}
callback();
}
I just want to print: testing2 new numeric string = 11
but both "false" value and null value not working in the above if-condition: $ truffle exec findnumeric.js
$ truffle exec findnumeric.js
Using network 'development'.
word =11
testing2 new numeric string = 11
word ==
word =
testing2 new numeric string =
word =cccc
word ==
word =
testing2 new numeric string =
word =
testing2 new numeric string =
word =
testing2 new numeric string =
word =
testing2 new numeric string =
word =
testing2 new numeric string =
word =
testing2 new numeric string =
word =
testing2 new numeric string =
word =(bbbb
word =sssss
word =)=
word =ttttttttt("")
Somebody please guide me.
Zulfi.