Javascript boolean interpretation

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


[ Read the rest of the story in the original article... ]

Related Articles:

(This is an automated generated content. If you are the owner of this article and don't want to show this here, just write me at post@12n3.net and I'll remove it immediatly)

Login