Hi,
I have the following code:
var HD = function() { };
HD.Car = (function() {
var _date = "09/07/2010";
return {
Make: undefined,
Model: undefined,
showMakeAndModel: function() {
document.write(this.Make + " " +
this.Model +
" (data correct as of " + _date + ")");
}
};
})();
var bert = new HD.Car();
bert.Make = "Ford";
bert.Model = "Capri";
window.onload = bert.showMakeAndModel();
And get the following error:
HD.Car is not a constructor
All I'm trying to do is test (to learn) the 'singleton pattern' with closure (for private members) so not a 'real' example, but the book I'm reading suggests this is the way to do it.
So a little confused - any help would be much appreciated.. Rob