Your SlideShare is downloading. ×
How I Learned toStop Worrying and  Love JavaScript
JavaScript•Technically: ECMAScript•ECMA-262 Specification (currently v5.1)•Weakly typed, interpreted, object based, functio...
The History•Created by Brendan Eich in 10 days•Released in 1995 as part of Netscape Navigator 2.0•First standardised in 19...
The Lineage• Scheme: Functional•Self: Prototypical•Java: Ugly
The Problems•The Name: JavaScript•Early uses: sparkly text•Lack of useful features in Browser: e.g. XMLHttpRequest•Slow
The Problems•Weird Shit:NaN != NaN // true[] + {} = 0{} + [] = [Object object]‘ ’ == ‘0’ // false0 == ‘ ’   // true0 == ‘0...
The Problems•The DOM•Anyone can do it!•jQuery
The Awesome       Functional Programming• Functions are first class• Incredibly powerful• Closures / Lambda Calculus• Callb...
The Awesome             Functional Programmingvar array = [4, 8, 9, 1, 3, 9];var weirdArray = (function() {  var newArray ...
The Awesome                Functional Programmingvar go = function (callback) {     var logger = function (fn, name) {  va...
The Awesome        Prototypical Inheritance• Objects without classes• Powerful enough that it can pretty much emulate  cla...
You Need to Know• JavaScript is the new bytecode?• Web apps are the future?• Thin server-side architectures?• Can’t be rep...
Upcoming SlideShare
Loading in...5
×

How I Learned to Stop Worrying and Love JavaScript

607

Published on

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

  • Be the first to like this

No Downloads
Views
Total Views
607
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • - JavaScript: Sounds like a simplified Java. Actually way more powerful.\n- XMLHttp: first in 1999 in IE5, Mozilla 2002, Safari 2004\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript of "How I Learned to Stop Worrying and Love JavaScript"

    1. 1. How I Learned toStop Worrying and Love JavaScript
    2. 2. JavaScript•Technically: ECMAScript•ECMA-262 Specification (currently v5.1)•Weakly typed, interpreted, object based, functional, prototypical
    3. 3. The History•Created by Brendan Eich in 10 days•Released in 1995 as part of Netscape Navigator 2.0•First standardised in 1997•Also know as Mocha, LiveScript,
    4. 4. The Lineage• Scheme: Functional•Self: Prototypical•Java: Ugly
    5. 5. The Problems•The Name: JavaScript•Early uses: sparkly text•Lack of useful features in Browser: e.g. XMLHttpRequest•Slow
    6. 6. The Problems•Weird Shit:NaN != NaN // true[] + {} = 0{} + [] = [Object object]‘ ’ == ‘0’ // false0 == ‘ ’ // true0 == ‘0’ // true
    7. 7. The Problems•The DOM•Anyone can do it!•jQuery
    8. 8. The Awesome Functional Programming• Functions are first class• Incredibly powerful• Closures / Lambda Calculus• Callbacks: non-blocking• Definitely not scripting!
    9. 9. The Awesome Functional Programmingvar array = [4, 8, 9, 1, 3, 9];var weirdArray = (function() { var newArray = [], i = 0, len = array.length; for (i = 0; i < len; i += 1) { newArray.push(array[i] + ‘ tiny monkeys’); } return newArray;}());console.log(weirdArray); // [‘4 tiny monkeys’, ‘8 tiny monkeys’, ..., ‘9
    10. 10. The Awesome Functional Programmingvar go = function (callback) { var logger = function (fn, name) { var i, array = []; var start = new Date().getTime(), for (i = 0; i < 2000000; i += log = function () {1) { var end = new Date().getTime(); array.push(i); return name + took + (end - start) + } milliseconds; }; return callback();} return fn(log); console.log(logger(go, go)); // ‘go took 114 milliseconds’
    11. 11. The Awesome Prototypical Inheritance• Objects without classes• Powerful enough that it can pretty much emulate classical inheritance• Can reduce code significantly if used properly• Can be a bit confusing at first
    12. 12. You Need to Know• JavaScript is the new bytecode?• Web apps are the future?• Thin server-side architectures?• Can’t be replaced?• Windows 8• Multi-processor support

    ×