I managed to break a bit of code by adding a semi colon.
Does the inclusion of a superfluous semicolon make the code ignore the if... statement and run the code normally attributed to truth anyway? Or does something else happen under the hood, so to speak?
var str = "NEWS";
var d = "W";
for (var i = 0; i < str.length; i++)
{
if (str[i] === d); // extra semi colon
{
alert("!" + str[i]);
break;
}
}
Aucun commentaire:
Enregistrer un commentaire