No Block-Level Scopes
JavaScript has no block-level scopes.
<!DOCTYPE html>
<html>
<head>
<title>Example</title>
<script type="text/javascript">
if (true) {
var color = "blue";
}
document.writeln(color); //"blue"
for (var i = 0; i < 10; i++){
document.writeln(i);
}
document.writeln(i); //10
</script>
</head>
<body>
</body>
</html>