Hi,
I am trying to check the if -condition, but it does not work if the condition is false. Following is my code:
Hi,
I am using isNaN(arg) in a if condition but if the arg is a null value, control enters into if condition. How can I avoid it:
My code is:
I just want to print "new numeric string = 11" butI am getting null values also:
Zulfi.
I am trying to check the if -condition, but it does not work if the condition is false. Following is my code:
Hi,
I am using isNaN(arg) in a if condition but if the arg is a null value, control enters into if condition. How can I avoid it:
My code is:
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
console.log("word =" + word)
//NaN = not a number
if (isNaN(word) === false && word !== null){
console.log("new numeric string = " + word);
}
}
}
catch (error) {
console.log(error)
}
callback();
}
I just want to print "new numeric string = 11" butI am getting null values also:
Somebody please guide me.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("")
@lc2530hz:~/Truffle_programs/txorigin_assertion_script_tool$
Zulfi.