Skip to content

Instantly share code, notes, and snippets.

@suhailgupta03
Created August 3, 2023 16:37
Show Gist options
  • Save suhailgupta03/4399abaefe1366c7fc5f49e73fbef3c4 to your computer and use it in GitHub Desktop.
Save suhailgupta03/4399abaefe1366c7fc5f49e73fbef3c4 to your computer and use it in GitHub Desktop.
let i = 0;
function greet() {
i++;
console.log("Hello, World! ", i);
if( i >= 500) {
return;
} // it is very important to have a base case
// if you do not have a base case, you will
// have an infinite loop
// and your program will crash (stack overflow)
greet(); // recursive call
// recursion means a function calling
// itself
}
greet();
@suhailgupta03
Copy link
Author

suhailgupta03 commented Aug 3, 2023

`function multiply(a, b) {
return a * b;
}

function square(n) {
return 25;
// example: 5 * 5 = 25
// 5^2
}

function printSquare(n) {
var squared = 25;
console.log(squared);
}

printSquare(4);`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment