Add
Description
Write a function that returns the sum of two numbers.
Example
For param1 = 1
and param2 = 2
, the output should be
add(param1, param2) = 3
.
Input/Output
-
[execution time limit] 4 seconds (js)
-
[input] integer param1
Guaranteed constraints:
-1000 ≤ param1 ≤ 1000
.
- [input] integer param2
Guaranteed constraints:
-1000 ≤ param2 ≤ 1000
.
- [output] integer
The sum of the two inputs.
[JavaScript (ES6)] Syntax Tips
1
2
3
4
5
6
// Prints help message to the console
// Returns a string
function helloWorld(name) {
console.log("This prints to the console when you Run Tests");
return "Hello, " + name;
}
Solution
1
2
3
function add(param1, param2) {
return param1 + param2;
}