[해결로 표시] JavaScript에서 3개의 숫자를 합하는 함수

  

3
주제 스타터

Write a JS function that takes three numbers as input and outputs their sum.

The input comes as three number arguments passed to your function.

The output should be printed to the console.

Examples:

Input: 2, 3, 4    

Output: 9

Input: 1.5, 1.5, -1    

Output: 2

1개 답글
2

Here's my code:

function sumNumbers(a, b, c) {
 
    var sum = a + b + c;
 
    console.log(sum);
}
 
sumNumbers(1, 2, 3);
 
//sumNumbers(-1, -2, -3);
// -6
 
//sumNumbers(2.5, 3.5, -1);
// 5
공유: