On Sun, Aug 14, 2011 at 7:11 AM, Esa <esa.ilm...@gmail.com> wrote:

> You don't have to add '==true' in if statement. JavaScript makes the
> test by default.
> if(x==true) can be written simply if(x)


Those are not quite the same thing. For example:

x = {};
if( x ) alert( 'x' );  // will alert
if( x == true ) alert( 'x == true' );  // will NOT alert

But your point is correct that you don't need to use '== true', except in
the rare case where you actually want to distinguish 'true' itself from
other 'truthy' values. And in that case you'd probably want to use '===
true' to avoid JavaScript's type coercion.

-Mike

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to