getType=function(object){return object? object.type : this.type}
Person={
type: "Person",
extend: function(o){
for(var i in o) {if(!o.hasOwnProperty(i)) return this; this[i]=o[i]} return this
},
clone: function(){
return Object.create(this)
},
getType: getType,
getData: function(){return this.name+" "+this.age}
}
Student=Person.clone().extend({
type: "Student",
getFuckingData: function(){return "I am "+this.name+" and I'm motherfucker"}
})
john=Student.clone().extend({name: "John", age: 19})
with(console){
log(getType(john))
log(getType.call(john))
log(getType.apply(john))
log(getType.bind(john)())
log(john.getType())
log(john.getData(), john.getFuckingData())
}
// ::: Student
// ::: Student
// ::: Student
// ::: Student
// ::: Student
// ::: John 19 I am John and I'm motherfucker