It's strange how cNum always gets +1, even when cNum==10
The cNum is taken from my.json.
Is it a string? But then it can participate in arithmetic.
“cNum”: 24.
Here (cNum>6) seems to work, even though checkCode(); has been executed, cNum still increases by 1.
cNum keeps increasing whenever you click on it!
And it will add two 1's (+1+1),I checked elsewhere without the same setting.
if (cNum <= 6) {
readwriteJSON();
}
else if (cNum >6) {
checkCode();
}
function readwriteJSON() {
var myJSON = readFile(pathToMyJSONFile);
if (!myJSON)
return alert('Could not read JSON file.');
myJSON = JSON.parse(myJSON);
cNum = myJSONObject.cNum;
myJSON.cNum = cNum + 1;
alert(cNum);
var f = writeFile(pathToMyJSONFile, JSON.stringify(myJSON, undefined, '\t'));
}
