Setting default optional values in JavaScript is usually done via the || character
||
var Car = function(color) { this.color = color || \'blue\'; };
You can do this:
this.hasWheels = hasWheels !== false;
That gets you a true value except when hasWheels is explicitly false. (Other falsy values, including null and undefined, will result in true, which I think is what you want.)
true
hasWheels
false
null
undefined