Skip to content

Instantly share code, notes, and snippets.

@ItangSanjana
Created December 21, 2014 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ItangSanjana/8afda0c6d7de39cbf1a0 to your computer and use it in GitHub Desktop.
Save ItangSanjana/8afda0c6d7de39cbf1a0 to your computer and use it in GitHub Desktop.
The Infinite Loop of "I Love U" In JavaScript
//The Conditionless For
for (;;) {
console.log("\u0049 \u2665 \u0055");
}
//The Unchanging Condition
while (1 < 2) {
console.log("\u0049 \u2665 \u0055");
}
//Infinite Recursion
function iLoveYou() {
console.log("\u0049 \u2665 \u0055");
iLoveYou();
}
//The For Loop Reset
for (var i = 0; i < 2; i++) {
console.log("\u0049 \u2665 \u0055");
i = 0;
}
//60 times Per Second
function iLoveYou() {
console.log("\u0049 \u2665 \u0055");
var repeat = window.requestAnimationFrame(iLoveYou);
}
//Global Condition, Local Change (a variant on The Unchanging Condition)
var i = 0;
function increment() {
var i; // creates local var
i++;
}
while (i < 5) {
console.log("\u0049 \u2665 \u0055");
increment();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment