samedi 29 septembre 2018

object keys are undefined in if conditional, but inside the if statement I can access it

As the title states, I have a variable which is a javascript object, i'm comparing it with another js object by stringifying them. The problem is that the variable is completely accessible without calling the keys, so if(JSON.stringify(response) == JSON.stringify(lastcmd)) works perfectly fine, but accessing lastcmd's id key will cause it to throw undefined.

full code link here

Aucun commentaire:

Enregistrer un commentaire