Q:

Write a JavaScript program to compute the sum of three elements of a given array of integers of length 3

0

Write a JavaScript program to compute the sum of three elements of a given array of integers of length 3.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

function sum_three(nums)
{
  return nums[0] + nums[1] + nums[2];
}

console.log(sum_three([10, 32, 20]));  
console.log(sum_three([5, 7, 9])); 
console.log(sum_three([0, 8, -11]));

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now