I\'m trying to use some of the more advanced OO features of Javascript, following Doug Crawford\'s \"super constructor\" pattern. However, I don\'t know how to set and get types
If you declare Bicycle like this, instanceof will work:
function Bicycle(tires) {
this.tires = tires;
this.toString = function () {
return 'Bicycle with ' + tires + ' tires.';
}
}
var b = new Bicycle(2);
console.log(b instanceof Bicycle);