OMG JavaScript
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

OMG JavaScript

on

  • 2,371 views

 

Statistics

Views

Total Views
2,371
Views on SlideShare
2,370
Embed Views
1

Actions

Likes
2
Downloads
15
Comments
0

1 Embed 1

https://si0.twimg.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

OMG JavaScript Presentation 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