Expressions help

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I am using Javascript to make a kind of calculator. I am trying to do
addition, but when I use it, it just displays the numbers together, not
added together. Example:
function additionCalculator(num1, num2){
var total = num1 + num2
return total

I try to add the numbers, but it just puts them together.

Also, I am trying to use subtraction and division, but I do not know

Can anybody help?

   / | Mwh   ||
  -  ||----||

Re: Expressions help

mwh mumbled the following on 05/05/2005 02:21:
Quoted text here. Click to load it

Amazing what you can find if you type in Javascript adding numbers into

Mobile Number Network Checker - /
Creative writing & Poems - /
Leovanna Leonbergers - /

Re: Expressions help

While the city slept, mwh ( feverishly typed...

Quoted text here. Click to load it

From the FAQ's for the news:comp.lang.javascript newsgroup
( /), the following should help;

    4.21 Why does 1+1 equal 11? or How do I convert a string to a number?

Hope that helps,

Nigel Moss
Mail address will bounce. | Take the DOG. out!
"Your mother ate my dog!", "Not all of him!"

Site Timeline