!SLIDE
!SLIDE
- Education Hacker, GitHub
- Instructor, NYU
- Organizer, Hacker Hours
- Author, Developing a Backbone.js Edge
!SLIDE
- interpreted, scripting language
- weakly (bad-duck) typed
- single-threaded
- first-class functions
- prototypal inheritance
!SLIDE
- designed in a week by Brendan Eich for Netscape
- inspired by Self and Scheme, not Java
- server-side since 1994, popularized by Node.js
- "JavaScript" trademark owned by Sun, so formal name is "ECMAScript"
!SLIDE
- started in late 90's as IE replaced Netscape
- huge leaps in JS VM speed
!SLIDE
iq12.com/old_blog/as3-benchmark/
!SLIDE
- primitives (pass by value)
- string
- boolean
- number
- objects (pass by reference)
- objects
- arrays
- functions
!SLIDE
- the only numeric datatype
- floating point! (not "hardcore")
!SLIDE
First-class!
@@@javascript
var myFun = function(){
return 'foo';
};
myFun(); // 'foo'
var otherRef = myFun;
otherRef(); // 'foo'
!SLIDE
@@@javascript
var elements = $('.submit');
elements.on('click', function(){
alert('Thanks for buying!');
});
!SLIDE
Functional, not block-level (C-style)
@@@javascript
if (true) {
var foo = 6;
}
foo; // 6
!SLIDE
@@@javascript
var outer = function(){
var foo = 6;
var inner = function(){
return foo;
};
inner(); // 6
};
!SLIDE
@@@javascript
var wrapper = function(){
var foo = 6;
var inner = function(){
return foo;
};
return inner;
};
var wrapped = wrapper();
wrapped(); // 6
.notes show binding of context?
!SLIDE
@@@javascript
var myVariable = "I'm global!";
function printMyVariable(){
return this.myVariable;
}
printMyVariable(); // "I'm global!"
printMyVariable.apply({ myVariable: "I'm local!" }); // "I'm local!"
.notes too detailed?
!SLIDE
@@@javascript
var Person = function(first, last){
this.first = first;
this.last = last;
};
var bob = new Person('Bob', 'Hope');
var sally = new Person('Sally', 'Field');
bob.first; // 'Bob'
!SLIDE
!SLIDE
nope.
!SLIDE
@@@javascript
var app = {}; // global
app.views = {};
app.views.sidebar = {};
!SLIDE
- CoffeeScript
- TypeScript
!SLIDE
!SLIDE
- Object.observe
- modules
- getters and setters
- generators
!SLIDE
!SLIDE
!SLIDE
- jQuery
- Underscore
!SLIDE
- Backbone
- Spine
!SLIDE
!SLIDE
- Sproutcore
- jQuery UI
- jQuery Mobile
- Bootstrap
!SLIDE
- http://www.youtube.com/watch?v=hQVTIJBZook
- asm.js
- performance history
- https://docs.google.com/presentation/d/1Gv-dvU-yy6WY7SiNJ9QRo9XayPS6N2jtgWezdRpoI04/edit#slide=id.p
- https://github.com/afeld/advanced_js#resources
!SLIDE
Aidan Feldman