###First old style:
function Something() {
this.depth = 0;
}
Something.prototype.incDepth = function() {
this.depth++;
}
foo = new Something()###Second old style:
function login () {
return {
get: function(req,res,next) {
}
}
return {
post: function(req,res,next) {
}
}
}
var a = login()###The new way:
class Something {
constructor() {
this.depth = 0;
}
inc() {
this.depth++;
}
}
let foo = new Something();