Add 1000 to 100 to display 1100
Posted 29 August 2013 - 09:31 PM
I have a variable which is 100 and I want to add 1000 to it making 1100
tbox$count.value = change$count+1000;
It give the following 1001000
What do I need to do to make it display 1100?
Posted 29 August 2013 - 09:38 PM Best Answer
tbox$count.value = (+change$count)+1000;
- heldenbrau likes this
Did I help you out? Feeling generous? I accept tips via Bitcoin @ 14mDxaob8Jgdg52scDbvf3uaeR61tB2yC7
Posted 29 August 2013 - 09:53 PM
Thanks loads, that worked. Should have asked here an hour ago instead of looking up all this parseInt stuff that didn't make any sense.
Posted 30 August 2013 - 01:11 PM
tbox$count.value = parseInt(change$count)+1000;or even
tbox$count.value = Number(change$count)+1000;The overall takeaway here is that wherever you got
typeofoperator to check variable type) and/or convert variable type before performing operations, to ensure expected results.
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users