On Github clux / jsCoreTalk
"Everyone should be upset with JavaScript"
--Eirik http://github.com/clux
DOM + AJAX APIs
Canvas, WebGL, Websockets, Webworkers, Web components
NodeJS
CoffeeScript, TypeScript, ASM.js
Core language ->
operators, syntax, keywords, inheritance
timers
scope and closures
original 8 built in types
function User(name) { this.name = name; } User.locate = function (name) { .. }; User.prototype.greet = function () { return 'hi: ' + this.name; } var me = new User('Eirik'); me instanceof User; // true // where does properties on `me` live? // NB: me.property === me['property'] // me.qwfp // User.prototype.qwfp // Object.prototype.qwfp // -> undefined
{key: value, ...}
.keys
.create
.freeze
.isFrozen
.seal
::toString
::valueOf
JSON global
[a, b, c]
::toString
::join
::concat
::sort
::reverse ::slice
::forEach ::map ::filter ::reduce
::indexOf ::lastIndexOf
::pop ::push ::shift ::unshift
::every ::some
"ab©"
::toString
::slice
::indexOf
::replace
::match
::toUpperCase
::toLowerCase
::trim
new Date()
.now
.parse
::valueOf
::toJSON
::otherHelpfulMethods
true,false
::toString
::valueOf
123
::toString
.isFinite
.isNaN
Math global
/^match[u|i]$/
::toString
::test
function (args) { body; }
::toString
::call
::apply
::bind
var fn = function () { code(); } // all equivalent fn(arg1, arg2, arg3); fn.call(this, arg1, arg2, arg3); fn.apply(this, [arg1, arg2, arg3]); fn.bind(this, arg1, arg2, arg3)(); fn.bind(this, arg1, arg2)(arg3); fn.bind(this, arg1)(arg2, arg3); fn.bind(this)(arg1, arg2, arg3);
function User(name) { this.name = name; } for (var i = 0; i < 5; i += 1) ; console.log(i) // 5 User.prototype.context = function () { return this; }; var ea = new User('eirik'); ea.context(); // { name: 'eirik' } this; // global object User.prototype.context = function () { return (function () { return this; })(); }; ea.context(); // global object User.prototype.context = function () { return (function () { return this; }).call(this); }; ea.context(); // { name: 'eirik' } User.prototype.context = function () { var that = this; return (function () { return that; })(); };