Stupid Javascript question

Devin Whalen devin-Gq53QDLGkWIleAitJ8REmdBPR1lH4CV8 at public.gmane.org
Fri Feb 11 21:27:44 UTC 2005


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



> --
> 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
> 
-- 
Devin Whalen
Programmer
Synaptic Vision Inc
Phone-(416) 539-0801
Fax- (416) 539-8280
1179A King St. West
Toronto, Ontario
Suite 309 M6K 3C5
Home-(416) 653-3982


Take back the Web with FireFox....a browser you can trust
www.getfirefox.com

   .-.
   /v\    L   I   N   U   X
  // \\  
 /(   )\
  ^^-^^   

--
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