Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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