Stupid Javascript question

Lance F. Squire lance-5ZoueyuiTZhBDgjK7y7TUQ at public.gmane.org
Fri Feb 11 21:46:29 UTC 2005


Devin Whalen wrote:
> On Fri, 2005-02-11 at 16:24 -0500, Lance F. Squire wrote:
> 
>>How do I add two values?
>>
>>a=2;
>>
>>A*A=4 but A+A=22
>>
>>Been searching google to no avail...
>>
>>Thanks in advance.
> 
> 
> 
> Yeah, javascript is stupid like that.  The plus sign is the concat as
> well as add.  I usually do (A * 1) + (A * 1) = 4
> ugly, but it works :).  This makes sure that js knows you are dealing
> with numbers and not strings.  There is probably another way but this
> works for me.
> 
> Later
> 

It's quick! It's simple! It works for me! ;)

Thanks!

Lance F. Squire
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list