I have two simple questions for you about boolean values in Javascript.
When will browser show alert message:
if (a-b) alert(“it’s true!”);
And another one
What will be printed as result of running this script:
for (var n=10; n; n– )
{
document.write (n + “,”);
}
The answer for both questions relies on the same principle of what JavaScript engine will evaluate as true and what as false.
Related posts:Javascript pseudo protocol (is EVIL)Javascript function context, “apply” method and lost “this” objectC# LINQ Teaser