View Single Post
Old 08-04-2012, 09:51 PM   PM User | #6
Logic Ali
Regular Coder

 
Logic Ali's Avatar
 
Join Date: Sep 2010
Location: London
Posts: 959
Thanks: 0
Thanked 198 Times in 193 Posts
Logic Ali will become famous soon enoughLogic Ali will become famous soon enough
Quote:
Originally Posted by AndrewGSW View Post
Code:
var result = "I'm coding like a champ!".length > 10 ;

alert( result );
That might display 1 rather than true:
If you convert a boolean to a number, you'll get 1 or 0. If the result of an expression is a boolean, then that is what it will display.

alert( typeof ( "I'm coding like a champ!".length > 10 ) ) boolean
Logic Ali is offline   Reply With Quote
Users who have thanked Logic Ali for this post:
Doubleflame (08-05-2012)