Posted by admin »
Add Comment »
Forget everything you know about OOP.
var mammal = {getName:function(){console.log("I am a mammal")}};
var Cat = function() {this.getName = function() {console.log("I am a cat")}};
Cat.prototype = mammal;
var Man = function() {this.getName = function() {console.log("I am a man")}}
Man.prototype = mammal;
luke = new Man();
luke.getName();
>>> I am a man
luke instanceof Cat
>>> true
If you are thinking “WTF???” you are wrong. JavaScript objects are decoupled from constructors and instanceof is just a unlucky naming to say something as simple as:
luke.__proto__ == Cat.prototype;
Posted by admin »
Add Comment »
For a little bit of time this blog will be not anymore in an almost correct Italian but in a seriously broken English.
Yes, it’s time to give me a try about English blogging.
I’ve decided also to use a new theme for this blog. I really like the old one, but it’s not the best one to show “lines of codes” and nerd stuff… and in the next future I’d like to talk a lot about web code, and forget for a time “the Universe and Everything”.
Please, say me good luck.
Posted by admin »
Add Comment »
medioevo informatico, ovvero come ti tutelo gli interessi del berlusca http://tinyurl.com/yenwvem
Posted by admin »
Add Comment »
clean the house or don’t clean the house, that’s the problem!
Posted by admin »
Add Comment »
neve e armageddon a dublino sono sinonimi
Posted by admin »
Add Comment »
rispolvera la digital ixus
Posted by admin »
Add Comment »
che c’e’ di meglio di un trasloco a Natale?