Your SlideShare is downloading. ×
0
OMG JavaScript
OMG JavaScript
OMG JavaScript
OMG JavaScript
OMG JavaScript
OMG JavaScript
OMG JavaScript
OMG JavaScript
OMG JavaScript
OMG JavaScript
OMG JavaScript
OMG JavaScript
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

OMG JavaScript

2,207

Published on

Published in: Technology, Business
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,207
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
17
Comments
0
Likes
3
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. About duck typing in dynamiclanguages:“My god how you can write a real programwhen you just assigning random crap toanother crap and expecting it to work” – John Carmack, founder of id Software, developer ofpopular game titles like Wolfenstein , Doom, Quake and Rage, well-known open source advocate, millionaire.
  • 2. JavaScript is reallycomplicated language…
  • 3. var a = 012console.log( a )→ 10 OMG!
  • 4. console.log( "3" + 1 )→ "31"console.log( "3" – 1 )→2 OMG!!console.log( "222" - -"111" )→ "333" OMG!!!
  • 5. console.log( 9999999999999999 )→ 10000000000000000 OMG!!!!console.log( 111111111111111111111 )→ 111111111111111110000
  • 6. console.log( Math.max() )→ -Infinityconsole.log( Math.min() )→ Infinityconsole.log( new Array([], null, undefined, null) == ",,,"; )→ truevar foo = [0];console.log(foo == !foo);console.log(foo == foo);→ true→ true
  • 7. console.log( 3.toString() )console.log( 3..toString() )→ SyntaxError: identifier starts immediately after numeric literal→ "3"var a = new Number;console.log(a == 0)var a = new String;console.log(a == "")var a = new Object;console.log(a == {})var a = new Array;console.log(a == [])→ true→ true→ false→ false
  • 8. var a = {};console.log( a == {} );var a = [];console.log( a == [] );→ false→ falseconsole.log( (!+[]+[]+![]) );→ "truefalse"console.log((![]+[])[+[]]+(![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]] )→ "fail"
  • 9. console.log( {} + {} );→ NaNconsole.log( [] + [] );→ ""console.log( [] + {} );→ "[object Object]"console.log( {} + [] );→0console.log( 1 < 2 < 3 );console.log( 3 < 2 < 1);→ true→ true
  • 10. JavaScript. Just be smarter!
  • 11. Links WTF JavaScript: http://www.wtfjs.com/ Destroy All Software Screencasts: http://www.destroyallsoftware.com/ JavaScript Tutorial: http://www.javascript.info/ JavaScript Specification: http://www.ecma- international.org/publications/standards/Ecma- 262.htm

×