Chapter 3: The Artsy Solutions

Now that we've covered the basics of catching bugs like it's nobody's business, let's talk about the really tricky ones.

Fixing the Infinite Loop of Doom

When the bugs start to get real, you need real solutions. Like this:

			if (true) {
				while (true) {
					print("I'm stuck in an infinite loop!");
				}
			}
			

Just kidding, that's not a real fix. But seriously, try this:

			var i = 0;
			while (i < 10) {
				console.log("I'm looping, I'm looping!");
				i++;
			}
			

Or, if you're feeling fancy:

			for (var i = 0; i < 10; i++) {
				console.log("I'm looping, I'm looping!");
			}
			

See? Easy peasy.

You can find more artsy solutions in: