Last active
March 23, 2021 02:59
-
-
Save ANUPAMCHAUDHARY1117/8f11d20a3b8c192474f78c9c9dc4c02a to your computer and use it in GitHub Desktop.
This file contains 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
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)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice hack