Write a JavaScript program to compute the sum of the two given integers. If the two values are same, then returns triple their sum.
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));
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
need an explanation for this answer? contact us directly to get an explanation for this answer