Skip to content

Instantly share code, notes, and snippets.

@suhailgupta03
Created July 31, 2023 16:34
Show Gist options
  • Save suhailgupta03/d15f48b0d725c01e6c4f4d851c18ee7d to your computer and use it in GitHub Desktop.
Save suhailgupta03/d15f48b0d725c01e6c4f4d851c18ee7d to your computer and use it in GitHub Desktop.
// the reason we have functions is to avoid
// repeating code
function sum(arg1, arg2) {
var number1 = arg1;
var number2 = arg2;
var sumOfNumbers = number1 + number2;
console.log(sumOfNumbers);
}
sum(1, 2);
sum(100, 200);
sum(1000, 2000);
// In the above statement, we are calling the function SOME_NAME()
// and it will print the sum of the numbers.
// calling the function means that we are asking the function
// to execute the code inside it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment