Laurynas Veržukauskas
NFQ Akademija
lack of module system
weak-typing
late binding
finicky equality/automatic conversion
this behaviour
define([
'jquery',
'modernizr',
'utils/proxy',
'bootstrap/tooltip'
], function ($, Modernizr, proxy) {
'use strict';
function Tooltip() {
if (Modernizr.ios) {
return {
create: function () {
return this;
}
};
}
}
Tooltip.prototype.create = function (element, options) {
// some code removed from here
return this;
};
return new Tooltip();
});
CoffeeScript
TypeScript
Dart
class Animal
constructor: (@name) ->
move: (meters) ->
alert @name + " moved #{meters}m."
class Snake extends Animal
move: ->
alert "Slithering..."
super 5
class Horse extends Animal
move: ->
alert "Galloping..."
super 45
sam = new Snake "Sammy the Python"
tom = new Horse "Tommy the Palomino"
sam.move()
tom.move(34)
class Animal {
constructor(public name) { }
move(meters) {
alert(this.name + " moved " + meters + "m.");
}
}
class Snake extends Animal {
move() {
alert("Slithering...");
super.move(5);
}
}
class Horse extends Animal {
move() {
alert("Galloping...");
super.move(45);
}
}
var sam = new Snake("Sammy the Python")
var tom: Animal = new Horse("Tommy the Palomino")
sam.move()
tom.move(34)
Big TypeScript example:
https://github.com/Microsoft/TypeScriptSamples/blob/master/d3/data.ts
TL;DR:
var obj = {
myMethod : function () {
// this == window
}
};
var myFun = obj.myMethod;
myFun();
//----------------------
function myFun() {
// this == obj
}
var obj = {
someData: "a string"
};
myFun.call(obj);
.no-cssgradients .glossy {
background: url("images/glossybutton.png");
}
.cssgradients .glossy {
background-image: linear-gradient(top, #555, #333);
}
Selenium vs PhantomJS
Karma vs Casper
data binding examples: