The State of RVA.JavaScript
James Long
RVA.js, Oct 2013
Who am I?
- James Long
- Mozilla, Apps Engineering
- JavaScript Expert
- nunjucks (templating engine)
- outlet (Lisp dialect)
- shade (3d WebGL engine)
About RVA.js
Taking a pulse of Richmond's tech scene
- Can Richmond's tech scene do better?
- How can we help?
- Do people want to learn about JavaScript?
What is this thing, JavaScript?
JavaScript is the language of the web, and more.
JavaScript != jQuery
Just like Ruby is not Rails and Python is not Django,
JavaScript is not jQuery.
In fact, it's so much more than that.
History
- Originally developed by Brendan Eich in 10 days
- In 1995, first shipped in Netscape Navigator as LiveScript.
-
Renamed to JavaScript shortly thereafter, gained wild popularity and success. Rest is history.
History
In 1996, JavaScript given to ECMA for standardization under the name ECMAScript
Trivia time. ECMA also standardizes:
- 8-inch floppy disk (also 5.25" and 3.5")
- CD-ROM volume and filestructure
- C# language specification
Today
Powers millions of websites
4 extremely advanced and competitive implementations (JIT-able engines)
Diverse, rich culture
Today
Haters gonna hate
(we could have been stuck with VBScript)
The language is good, but it takes some learning
The real power: platform and community
Powerful Webapps
Rich client/server architectures
Revolutionary frameworks like backbone, ember, angular
Simple, Efficient Backends
Completely asynchronous platform
Great for networking
Reuse code between client and server
Games
http://browserquest.mozilla.org/
WebGL
http://madebyevan.com/webgl-water/
Games
http://www.unrealengine.com/html5/
So Let's Talk JavaScript
function foo(x, y) {
return x + y;
}
console.log(4, 6); // -> 10
So Let's Talk JavaScript
function foo() {
var sum = 0;
for(var i=0; i<arguments.length; i++) {
sum += arguments[i];
}
return sum;
}
console.log(4, 6, 5); // -> 15
So Let's Talk JavaScript
function foo() {
_.reduce(arguments, function(total, num) {
return total + sum;
}, 0);
}
console.log(4, 6, 5); // -> 15
Luckily, JavaScript got one core thing right:
functions
Functional Programming
Functions are first-class values
function foo() {}
var foo = function() {}
bar(1, 2, 3, function() {});
Functional Programming
This single feature allowed JavaScript to thrive despite its shortcomings
- async (callbacks)
- modules
- private data
- many other interesting programming models
- fully dynamic, ready for the recent explosion of
dynamic languages
Closures
function foo(x) {
return function(y) {
return x + y;
}
}
var sum10 = foo(10);
console.log(sum10(5)); // -> 15
Closures
function getStatus(obj) {
var fullname = obj.first + ' ' + obj.last;
return function() {
$.get('/status', { name: fullname }, function(res) {
$('.result').text(res);
}
}
}
var req = getStatus({ first: 'James', last: 'Long' });
// later...
req();
ES6
- variable destructuring
var [x, y] = [5, 6];
var {x ,y} = {x: 5, y: 6}; - generators (like Python's `yield`)
- arrow function syntax
[0, 1, 2].map(function(x) { return x + 1; });
[0, 1, 2].map(x => x + 1); - block scoping: `let`
- proxies, maps, sets, modules
Developing JavaScript
Not Convinced?
http://mozilla.github.io/shumway/
Firefox OS
http://www.mozilla.org/firefoxos
So Back to RVA
What do you want out of this group?
Tell us what you work on, and
what you're interested in!
Thanks
The State of RVA.JavaScript
By jlongster
The State of RVA.JavaScript
I open the first meeting of RVA.js with a general overview of the exciting things on with JavaScript.
- 1,326