CES <none@none.com> writes:
[color=blue]
> While I digest your code I was wondering what kind of statement/form is this:
>
> Timer.prototype = {startTimer : function (){this.stopTimer();this.counterStatus();}, //Other methods}
>
> The "value : function()" makes it look like a switch but it obviously not??[/color]
It's not. It's part of the notation for an object literal. It has
the form
{ name : value , name2 : value2, <etc> }
[color=blue]
> I'm assuming that:
> Timer.prototype = {startTimer : function(){
> is equivalent to:
> Timer.prototype.startTimer = function (){[/color]
Almost, but not entirely.
In the first case, you create a new object, using an object literal
to define it, and then assigns that to Timer.prototype. That overrides
the existing value of Timer.prototye.
In the second case you merely add one property to the existing object
value of Timer.prototype. It retains its existing properties, including
Timer.prototype.constructor (with the default value Timer).
/L
--
Lasse Reichstein Nielsen -
lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'