Q:

Write a JavaScript program to compute the sum of the two given integers. If the two values are same, then returns triple their sum

0

Write a JavaScript program to compute the sum of the two given integers. If the two values are same, then returns triple their sum.

All Answers

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

function sumTriple (x, y) {
  if (x == y) {
    return 3 * (x + y);
    } 
   else
   {
    return (x + y);
   }
 }
console.log(sumTriple(10, 20));
console.log(sumTriple(10, 10));

 

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