jeudi 9 janvier 2020

Why does this if statement succeed with a non-boolean value? [duplicate]

This question already has an answer here:

var m = 5;
if (m) {
    document.write(m);
}

In my view, m is not a bool type, therefore, this if statement will not be executed. However, I do see the value of m printed on my screen. Why?

Aucun commentaire:

Enregistrer un commentaire