This entry was posted
on Tuesday, January 19th, 2010 at 1:55 pm and is filed under javascript, programming.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
This is an empty list, evaluating to an empty list.
>>> []
[]
This is false, because an empty list is empty, for this reason, js decides its more similar to
false than true. Since 0 is typically false, and one is typically true in computer programming.
>> [] == true
false
Since == is testing for equality.. And true is not false…
>> true == false
false
Since == is testing for equality, and false is false.
>>> false == false
true
when programming in a weakly typed language always be cognizant of types that are automatically coerced into other types during operations like this.
July 4th, 2010 at 11:41 am
This is an empty list, evaluating to an empty list.
>>> []
[]
This is false, because an empty list is empty, for this reason, js decides its more similar to
false than true. Since 0 is typically false, and one is typically true in computer programming.
>> [] == true
false
Since == is testing for equality.. And true is not false…
>> true == false
false
Since == is testing for equality, and false is false.
>>> false == false
true
when programming in a weakly typed language always be cognizant of types that are automatically coerced into other types during operations like this.