The condition b != "a" || b != "b" will always return true and it will always output “I am a ‘b'” .
To fix it you only should change b != "a" || b != "b" to b != "a" && b != "b"
var b = "b"
if(b != "a" && b != "b"){
alert("I am a 'b'")
}else{ alert("I am not a 'b'");
}