Setting default optional values in JavaScript is usually done via the || character
||
var Car = function(color) { this.color = color || \'blue\'; };
Without much confusion you can do like this to get a default true.
this.hasWheels=typeof hasWheels === 'boolean'?hasWheels:true
To get a default false
this.hasWheels=typeof hasWheels === 'boolean'?false