Ran into an interesting issue. I was working on trying to toggle a boolean that was assigned to a variable. It wasn't working and eventually I tried this code.
var status = false;
console.log(!status);
I expected it to provide true
in the console, but instead I got false
. I figured that javascript would run the code inside the parenthesis first to find it's value and then console.log the value. Could you please explain why I am not getting a true
value in the console?