Variable Scope Syndrome is a condition where a programmer is unable to tell where a variable is declared, used, or modified. Symptoms include:

The most common cause of Variable Scope Syndrome is poor naming conventions and lack of documentation.

Here's an example of the disease in action:

			var myVar = 10;
			function doSomething() {
				var myVar = 20;
				return myVar;
			}
			console.log(myVar); // outputs 10, but should output 20
		

To cure Variable Scope Syndrome, use block-level scope with let or const instead of var.

Learn how to split your code with block-level scope.

Next chapter: Chapter 4: The Great Scope Splitting Hoax