HTML5ANDCSS3 logoHTML5ANDCSS3Tools and Tutorials
  • Insights
  • Verify Certificate
HTML5ANDCSS3 logoHTML5ANDCSS3Tools and Tutorials
HTML5ANDCSS3 logoHTML5ANDCSS3Tools and Tutorials

HTML5andCSS3.org helps developers learn modern frontend skills with practical tutorials, production-ready snippets, and fast web tools built for everyday coding.

Quick Links

  • About Us
  • Contact Us
  • Privacy Policy
  • Copyright
  • Disclaimer

Top Tools

  • Try It Editor
  • JSON Formatter
  • CSS Minifier
  • HTML Minifier
  • Base64 Encoder / Decoder

Contact

  • business@html5andcss3.org
Newsletter

Learn at your own pace, practice with useful tools, and build websites you're proud of.

© 2011-2026 html5andcss3.org. All rights reserved.

How to Use

JavaScript Tutorial

JavaScript Introduction

What is JavaScriptJavaScript FeaturesJavaScript SyntaxHow to Add JavaScriptJavaScript OutputJavaScript Comments

JavaScript Basics

JavaScript VariablesJavaScript Data TypesJavaScript Operators

JavaScript Statement & Expression

JavaScript StatementsJavaScript ExpressionsJavaScript KeywordsJavaScript IdentifiersJavaScript Case SensitivityJavaScript SemicolonsJavaScript Code Blocks

JavaScript Conditions

JavaScript if StatementJavaScript if else StatementJavaScript else if StatementJavaScript switch Statement

JavaScript Loops

JavaScript for LoopJavaScript while LoopJavaScript do while LoopJavaScript break Statement
  1. Home
  2. /
  3. Tutorials
  4. /
  5. JavaScript Tutorial
  6. /
  7. JavaScript Case Sensitivity

JavaScript Statement & Expression

JavaScript Case Sensitivity

JavaScript is a case-sensitive programming language.

This means uppercase and lowercase letters are treated as different characters.

Example

Example

javascript

let name = "John";
let Name = "Emma";

In this example, name and Name are two different variables.

What Case-Sensitive Means

Case-sensitive means JavaScript treats capital letters and small letters differently.

Example

javascript

let city = "London";
let City = "Paris";
let CITY = "New York";

Here, all three variables are different because their letter cases are different.

VariableValue
<code>city</code>"London"
<code>City</code>"Paris"
<code>CITY</code>"New York"

Variable Names are Case-Sensitive

JavaScript variable names must be written with the same uppercase and lowercase letters every time.

Example

javascript

let userName = "John";

console.log(userName);

This works because the variable name is written correctly.

But this will not work:

Example

javascript

let userName = "John";

console.log(username);

Here, userName and username are different names. JavaScript will not treat them as the same variable.

Function Names are Case-Sensitive

Function names are also case-sensitive.

Example

javascript

function showMessage() {
  console.log("Hello JavaScript");
}

showMessage();

This works because the function name is called correctly.

But this will not work:

Example

javascript

function showMessage() {
  console.log("Hello JavaScript");
}

showmessage();

Here, showMessage and showmessage are different names.

JavaScript Keywords Must Be Lowercase

Most JavaScript keywords are written in lowercase.

Example

javascript

let age = 25;

if (age >= 18) {
  console.log("Allowed");
}

Here, let and if are written in lowercase.

Wrong example:

Wrong Example

javascript

Let age = 25;

If (age >= 18) {
  console.log("Allowed");
}

This will not work because Let and If are not valid JavaScript keywords.

Object Property Names are Case-Sensitive

Object property names are also case-sensitive.

Example

javascript

let student = {
  name: "John",
  age: 21
};

console.log(student.name);

This works because the property name is name.

But this will not work:

Example

javascript

let student = {
  name: "John",
  age: 21
};

console.log(student.Name);

Here, name and Name are different property names.

camelCase in JavaScript

JavaScript developers commonly use camelCase for variable and function names.

In camelCase, the first word starts with a lowercase letter, and the next words start with uppercase letters.

Example

javascript

let firstName = "John";
let totalPrice = 1500;
let userEmailAddress = "john@example.com";

function calculateTotalPrice() {
  console.log(totalPrice);
}

camelCase makes names readable and clean.

Good Naming Examples

Use clear and consistent names.

Example

javascript

let userName = "Emma";
let userAge = 24;
let isLoggedIn = true;
let totalAmount = 2500;

These names are easy to read and understand.

Complete Example

Complete Example

html

<!DOCTYPE html>
<html>
<head>
  <title>JavaScript Case Sensitivity</title>
</head>
<body>

  <h1>JavaScript Case Sensitivity</h1>

  <p id="result"></p>

  <script>
    let firstName = "John";
    let FirstName = "Emma";

    document.getElementById("result").innerHTML =
      "firstName: " + firstName + "<br>" +
      "FirstName: " + FirstName;
  </script>

</body>
</html>

Try It Yourself

Run the above example in the Try It Editor.

Try changing firstName to firstname in one place and check what happens.

Also try changing function names or object property names with different uppercase and lowercase letters.

Important Points

  • JavaScript is case-sensitive.
  • name, Name, and NAME are different identifiers.
  • Variable names must be written exactly the same every time.
  • Function names are also case-sensitive.
  • Object property names are case-sensitive.
  • JavaScript keywords like let, const, if, and function should be written in lowercase.
  • camelCase is commonly used for JavaScript variable and function names.

Conclusion

JavaScript case sensitivity means uppercase and lowercase letters are treated differently.

This rule applies to variables, functions, object properties, and keywords.

Understanding case sensitivity helps you avoid common errors and write cleaner JavaScript code.

PreviousJavaScript IdentifiersNextJavaScript Semicolons