Is JavaScript case sensitive? Give its example
Answers (1)
Add AnswerYes, it is a case-sensitive language, which means the identifiers, keywords, variables, and function names must be written with a consistent capitalization of letters.
Like many other programming languages, JavaScript has a set of rules for writing JavaScript programs or codes. Using the correct capitalization for naming keywords, identifiers, functions, and variables is one that must be followed.
What does it really mean?
It means that if you have created a variable named “temp” and while printing the value of this variable, you will write “Temp” instead of “temp”, it will not work properly and somehow will generate an error.
We can understand it more clearly with the help of an example:
Example:
<!DOCTYPE html> <html> <body> <h3>JavaScript is case Sensitive language</h3> <pidpid="demo"></p> <script> var marks,Marks; marks=0; //variable 1 Marks=100; // variable 2 document.write(Marks); </script> </body> </html>
Explanation of program
In the above program, we created two variables Marks and marks, and assigned them 0,100 values. When printing the value of the variable “marks” it will print 100 instead of 0, because, in JavaScript, marks and Marks are not the same things even if both variables are spelled the same.
Yes, JavaScript is case-sensitive.
built-in keywords, variables, function names, and other identifiers should be written with a consistent capitalization of letters.
For example, The for keyword must be typed “for” instead of “For” or “FOR“