In the process of extracting a value from a JSON file, I encounter the following situation:
var sta = req.jsonBody.sta //where req.jsonBody.sta = open
Based on this code snippet, my variable "sta" should be equal to "open". However, when I execute the following code:
var turnOn = true
var open = "open"
if (sta == open)
{
turnOn = false
console.log(sta)
}
console.log(turnOn)
The expected outcome is for the value of turnOn
to be false. Surprisingly, the console is printing true
instead. I am unsure about where I might have made an error.