Why is JavaScript case sensitive but HTML isn't?
Answers
A script is in plain text and not just markup like HTML, which is case insensitive. In JavaScript, the while keyword should be "while", not "While" or "WHILE". Case sensitivity is important since it is closely related to HTML, but some methods and events are mentioned differently. JavaScrip has a strict syntax to process the client-side-scripts written in JavaScript.
Some tags and attributes in HTML have the same name as JavaScript objects and properties. In HTML, the attribute and tag names are case-insensitive. The close association of HTML and JavaScript can lead to confusion, so case sensitivity is more important in JavaScript. For example, HTML onclick event attribute is mentioned as onClick in HTML but should be onclick in JavaScript.
The following two words in JavaScript are completely different:
var demo;
var DEMO;
The following are different object due to the case-sensitive features of JavaScript:
function Employee(id, name, subject){
this.id = id;
this.name = name;
}
var employee = new Employee("ee1", “John”,”30”);
While working with JavaScript, do check for capitalization of variable, function and object name. This will prevent syntax and other errors.
mark it as a brainlist