How can this POSSIBLY be happening?
var X = db.getItem('ShowDeleted');
console.log(X);
if (X) {
console.log(1);
} else {
console.log(2);
}
In Firebug, I’m getting:
true
1
false
1
As I fire the snippet in question.
Edit: I apologize for using db. in my example. db=localStorage.
As ghik pointed out, your
Xvalue is probably being returned as a string. Here is a jsfiddle script that works properly when set as a boolean, and displays your bizarre behaviour when set as a string