Post 17 made on Wednesday January 21, 2009 at 23:55 |
Barry Gordon Founding Member |
Joined: Posts: | August 2001 2,157 |
|
|
Why the myHour=1*myHour? I assume you are trying to ensure that myhour is a number and not a string holding a numeric value?
Javascript will do the conversion automatically when it does the comparson between the numeric as a string (myHour) and the numeric constants 18 and 7. The only time Javascript gets "confused" is with the "+" operator as that one is overloaded to mean addition or concatenation. Things like "Text"+a+b may produce unintended results if a and b are strings containing numbers and addition was meant for the second "+".
The fastest conversion is myHour=myHour-0 as subtraction is much faster than multiplication.
|
|
|