JavaScript is a case-sensitive language.
That means here capital letters as different from their lowercae letters.
JavaScript does not interpret VAR or Var as the keyword var.
Code:-
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h1>JavaScript is Case Sensitive</h1>
<p>Try change lastName to lastname.</p>
<input type="button" onclick="case_sen();" value="Check Case Sensitive">
<div id="d1"></div>
<div id="d2"></div>
<script>
function case_sen()
{
/*lastname and LASTNAME are not same*/
var lastname = "Merbin";
var LASTNAME = "Joe";
document.getElementById("d1").innerHTML = lastname;
document.getElementById("d2").innerHTML = LASTNAME;
}
</script>
</body>
</html>
No comments: