Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript Return a Value from a Function</title> </head> <body> <script> // Defining function function getSum(num1, num2) { let total = num1 + num2; return total; } // Displaying returned value document.write(getSum(6, 20) + "<br>"); // Prints: 26 document.write(getSum(-5, 17)); // Prints: 12 </script> </body> </html>