Friday, 10 November 2017

Why the JavaScript can be a case sensitive

In JavaScript, the case sensitivity does not just apply to variable names but also to JavaScript keywords, event handlers, and object properties or methods.

Example: Example to say JavaScript is a case senstive
<! DOCTYPE html> 
<html> 
<head> 
<title>Javascript Case Sensitivity</title> 
</head> 
<script type="text/javascript"> 
var customerName = "Peter write"; 
var CustomerName = "Charlie S write"; 
var CUSTOMERNAME = "Tom write"; 
document.write(customerName + '</br>' + CustomerName+ '</br>' + CUSTOMERNAME); 
</script> 
<body> 
</body> 
</html>

E.g. Description

Why Javascript is a case-sensitive:
JavaScript is a case-sensitive language.This means that language keywords, variables, function names, and any other identifiers must always be typed with a consistent capitalization of letters. The while keyword, for example, must be typed "while", not "While" or "WHILE". Similarly, online, Online, OnLine, and ONLINE are four distinct variable names.
In JavaScript, the case sensitivity does not just apply to variable names but also to JavaScript keywords, event handlers, and object properties or methods. Keywords in JavaScript are all lowercase, for example, while, for, if, else, and so on. On the other hand, methods (properties) use "camel-back" naming convention ( the first word is in lowercase and each successive first letter of each word is capitalized), for example, toArray(), lastModified(), and so on.

READMORE


No comments:

Post a Comment