Let's talk about JavaScript

(function(){
  var undefined = 42;
  console.log(undefined);
})();
(function(globalWindow, undefined){
  'use strict';
  var undefined = 42;
  console.log(undefined);
})(window);
Function.prototype.call=
(function(o){return function(){var r=o.apply(this,arguments);
if(typeof r=='number')return r+1;return r;}})
(Function.prototype.call);

It's not all that bad.

Fun

1995

10 days, LiveScript

1996

1997

ECMA-262

Features?

  • Dynamic

  • Object-based 

  • Runtime eval

There's more

  • First class functions

  • Prototype-based

  • Regular expression

+

jQuery

$('#something')
    .append('<div class="gall"><a href="javascript:void(0)">Linky</a></div>')
    .append('<div class="gall"><a href="javascript:void(0)">Linky</a></div>')
    .append('<button onclick="app.doStuff()">Button</button>');
$('a').addClass('reg-link')
    .find('span')
        .addClass('inner')
    .end().end()
    .find('div')
        .mouseenter(mouseEnterHandler)
        .mouseleave(mouseLeaveHandler)
    .end()
    .explode();
Made with Slides.com