Add two numbers with java script

GUYS, I didn’t get this challenge is for what? could some one tell me? thank u!

Your code so far


var sum = 10 + 10;

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/604.3.5 (KHTML, like Gecko) Version/11.0.1 Safari/604.3.5.

Challenge: Add Two Numbers with JavaScript

Link to the challenge:

it’s to learn one use of the + operator

1 Like

yes I got it .just I don’t understand, its used for any 2 numbers. because it was so simple. I can’t clarify my question very well. :thinking:

it’s simple because it is just showing how to add two numbers

2 Likes

The challenge question is just to show you that you can add together any two numbers using the + operator. In this case, you’re assigning the sum of those two numbers to a variable sum.

Any numbers will work in this case, and you can also use the operator in more complex situations. For example, you could write a function to add numbers together.

const sumOfTwo = (num1, num2) => {
  return num1 + num2;
} // Returns the sum of any numbers input as num1 and num2

sumOfTwo(12, 14); // Should return 26
1 Like

@ilenia @docdaneeka thank u so much for your help.

1 Like