0
Upcoming SlideShare
×

# Apples & Oranges? Adventures in Equality Comparison & one of the ‘Bad Parts’

326

Published on

Method of the Month (MOTM) for Cbusjs (Columbus JavaScript Users Group) 2011.04

Published in: Technology
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total Views
326
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
1
0
Likes
0
Embeds 0
No embeds

No notes for slide
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• undefined != true // true\nnull != true // true\n\n
• undefined != true // true\nnull != true // true\n\n
• undefined != true // true\nnull != true // true\n\n
• undefined != true // true\nnull != true // true\n\n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• JavaScript has bad parts...\n...and good parts.\n
• JavaScript has bad parts...\n...and good parts.\n
• \n
• \n
• \n
• \n
• \n
• \n
• ### Transcript of "Apples & Oranges? Adventures in Equality Comparison & one of the ‘Bad Parts’"

1. 1. Apples & Oranges?Adventures in Equality Comparison & one of the ‘Bad Parts’ Kevin Munc - @muncman
2. 2. Who needs transitivity?
3. 3. Who needs transitivity?‘’ == ‘0’
4. 4. Who needs transitivity?‘’ == ‘0’ false
5. 5. Who needs transitivity?‘’ == ‘0’ false okay...
6. 6. Who needs transitivity?‘’ == ‘0’ false okay...0 == ‘’
7. 7. Who needs transitivity?‘’ == ‘0’ false okay...0 == ‘’ true
8. 8. Who needs transitivity?‘’ == ‘0’ false okay...0 == ‘’ true hmm...
9. 9. Who needs transitivity?‘’ == ‘0’ false okay...0 == ‘’ true hmm...0 == ‘0’
10. 10. Who needs transitivity?‘’ == ‘0’ false okay...0 == ‘’ true hmm...0 == ‘0’ true
11. 11. Who needs transitivity?‘’ == ‘0’ false okay...0 == ‘’ true hmm...0 == ‘0’ true uh...
12. 12. The double-equals attempts type coercion.
13. 13. Crockford’s View=== and !== arethe equalitycomparisonoperators.== and != are the‘evil twins’.
14. 14. Not Truthy? Falsy?
15. 15. Not Truthy? Falsy?false == 0
16. 16. Not Truthy? Falsy?false == 0 true
17. 17. Not Truthy? Falsy?false == 0 truefalse == ‘0’
18. 18. Not Truthy? Falsy?false == 0 truefalse == ‘0’ true
19. 19. For crying out loud.
20. 20. For crying out loud.10 == ’10’
21. 21. For crying out loud.10 == ’10’ true
22. 22. For crying out loud.10 == ’10’ true10 == ‘010’
23. 23. For crying out loud.10 == ’10’ true10 == ‘010’ true