Created
August 3, 2023 16:37
-
-
Save suhailgupta03/4399abaefe1366c7fc5f49e73fbef3c4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
`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);`