mardi 28 novembre 2017

Strange boolean value bug in javascript

Not sure what is happening to the boolean value in the found property of this object. When I log the object the value is true then when I log just the property value it's false!

Im receiving this object from another developers code. I have confirmed that the object his code is passing my script is the same as the object that Im logging in my script. I have also tried multiple browsers and tried emptying the cache before running the application. Any idea why I'm not able to access the correct value for this property?enter image description here

var buildGraph_bfs = function(jsonData) 
{

//console.log("console.log(jsonData) : ");
//console.log(jsonData);
//console.log("console.log(jsonData.found) : " + jsonData.found);

var FOUND = jsonData.found;

if (FOUND) 
{
 console.log("found");
}
else{
  console.log("not found");
}

For the above code I always get "not found". The value is never altered in the following script.




Aucun commentaire:

Enregistrer un commentaire