Abstract “class”/type in JavaScript ECMA 5.

In ECMA 5 no classes exists but inheritans is created by prototype chains. How to create abstract structures which should not be used in code? I give some possible solution for that.

My proposition is to create “abstract” property in our abstract type prototype. So check code sample:
var Abs=function(){
//check if we have abstract paramater in prototype
if (Object.getPrototypeOf(this).hasOwnProperty("abstract")){
throw new Error("Can't instantiate abstract class!");
Abs.prototype.abstract=true; //here is abstract

Most important is our condition:


We check that our prototype has property abstract. Function hasOwnProperty checks only object, not checks its prototype properties, so every prototype created from prototype of Abs will not have abstract property, will only have it in prototype chain. Full jsFiddle example:

Check console to show results of example.
As You can see in example, it is possible to create objects from inherited types but not from type with abstract property in prototype ( Animal ).