Variable scope : Variable Definition « Language Basics « JavaScript DHTML
- JavaScript DHTML
- Language Basics
- Variable Definition
Variable scope
<html>
<head>
<script language="JavaScript">
<!--
var myVar = "Outside";
function testFunction() {
var myVar = "Inside";
alert("this.myVar: " + this.myVar);
alert("myVar: " + myVar);
}
testFunction();
//-->
</script>
</head>
</html>
Related examples in the same category