my dog learned polymorphism
The moose likes HTML, CSS and JavaScript and the fly likes if condition in JS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "if condition in JS" Watch "if condition in JS" New topic

if condition in JS

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Why if condition works for anything (not necessary boolean) in case of JS?
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

Why not ? So you can easily check if a reference exits or not.

[My Blog]
All roads lead to JavaRanch
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63869

It sort of follows the C/C++ rules rather than Java rules.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: if condition in JS
It's not a secret anymore!