TorqueBox, Immutant, Nodyn
JRuby, DynJS
Ruby, Javascript, Clojure, Java
It's Fun!
It's really easy to get started. Just open a browser.
Laptops, Phones, Tablets
Node.js
A large community of server side JavaScript developers.
JavaScript® (often shortened to JS) is a lightweight, interpreted, object-oriented language with first-class functions, most known as the scripting language for Web pages, but used in many non-browser environments as well such as node.js or Apache CouchDB. It is a prototype-based, multi-paradigm scripting language that is dynamic, and supports object-oriented, imperative, and functional programming styles.
https://developer.mozilla.org/en-US/docs/Web/JavaScript
First-class Functions
Functional Scope
Prototypical Inheritance
Data Types
DOM (Browser builtin JS)
var add5 = function(x) {
return x + 5;
}
add5(10); // 15
function add2(x) {
return x + 2;
}
function calculate(x, f) {
return f(x);
}
calculate(10, add5); // 15
calculate(10, add2); // 12
function calculator(f) {
return function(x) {
f(x);
}
}
var incrementFive = calculator(add5); // function
var incrementTwo = calculator(add2); // function
incrementFive(10); // 15
incrementTwo(10); // 12
function addSquares(a,b) {
function square(x) {
return x * x;
}
return square(a) + square(b);
}
a = addSquares(2,3); // returns 13
b = addSquares(3,4); // returns 25
c = addSquares(4,5); // returns 41
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope
function welcomer(salutation) {
return function(name) {
return [salutation, name].join(', ');
}
}
var frenchHello = welcomer('Bonjour');
var englishHello = welcomer('Hello');
var spanishHello = welcomer('Hola');
frenchHello('Pierre'); // Bonjour, Pierre
englishHello('James'); // Hello, James
spanishHello('Rodrigo'); // Hola, Rodrigo
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope
var Chip = function() {
this.flavor = 'Plain';
};
Chip.prototype.crunch = function() {
console.log(this.flavor + ' crunch!');
};
var chip = new Chip();
chip.crunch(); // "Plain crunch!"
var Dorito = function() {
this.flavor = 'Nacho cheese';
};
Dorito.prototype = new Chip();
var dorito = new Dorito();
dorito.crunch(); // "Nacho cheese crunch!"
Undefined, Null
Boolean, String
Number, Object
Array, Date
RegExp, Error (and friends)
Math, JSON
function popupAlert() {
var msg;
var response = confirm("Press a button!");
if (response === true) {
msg = "You pressed OK!";
}
else {
msg = "You pressed Cancel!";
}
document.getElementById("demo").innerHTML=msg;
}
DOM Manipulation: JQuery http://jquery.com
Functional Utilities: Underscore, Lodash
Model/View: Angular.js, Backbone.js
Package Management: NPM
Project Packaging and Build: Bower, Grunt
BaaS: Meteor.js, Derby