Jump to content

My strings keep concatenating - Not Adding together???


spires

Recommended Posts

Hi guys.

 

I'm doing a a simple equation, all I want to do is add to value together.

However, instead of adding the are concatenating. Both value are numeric so it should work fine, when I replace the variable with a static numeric number it works fine. but when I use the variable it keeps concatenating.

 

Any ideas?

 

My Code:

var joinedProduct=productarray[1]+productarray[2];
alert(joinedProduct);

 

productarray[1] = 60

productarray[2] = 60

output = 6060

not = 120

 

Thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.