• Save
How I Learned to Stop Worrying and Love JavaScript
Upcoming SlideShare
Loading in...5
×
 

How I Learned to Stop Worrying and Love JavaScript

on

  • 867 views

 

Statistics

Views

Total Views
867
Views on SlideShare
867
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

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
  • \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

How I Learned to Stop Worrying and Love JavaScript How I Learned to Stop Worrying and Love JavaScript Presentation Transcript

  • How I Learned toStop Worrying and Love JavaScript
  • JavaScript•Technically: ECMAScript•ECMA-262 Specification (currently v5.1)•Weakly typed, interpreted, object based, functional, prototypical
  • 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,
  • 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’ // true
  • The Problems•The DOM•Anyone can do it!•jQuery
  • The Awesome Functional Programming• Functions are first class• Incredibly powerful• Closures / Lambda Calculus• Callbacks: non-blocking• Definitely not scripting!
  • 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
  • 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’
  • 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
  • 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