Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ANUPAMCHAUDHARY1117/8f11d20a3b8c192474f78c9c9dc4c02a to your computer and use it in GitHub Desktop.
Save ANUPAMCHAUDHARY1117/8f11d20a3b8c192474f78c9c9dc4c02a to your computer and use it in GitHub Desktop.
const one = +true; //This would return 1 (Unary and boolean operator)
const zero = +false; // This would return 0 (Unary and boolean operator)
//Using string operations apending 1 and 0 and 0 to form "100"
const hundredInString = one.toString() + zero.toString() + zero.toString();
// To save the day for not using the loop, we are using recursion function.
const printInRecursion = (index) => {
if (index <= parseInt(hundredInString)) {
console.log(index);
printInRecursion(index + one);
}
return
}
printInRecursion(parseInt(one))
@Easy-Cloud-in
Copy link

Nice hack

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