Are Variable Names in JavaScript Case Sensitive?

Variable names in JavaScript are case-sensitive. This means that variables having the same name but different case are considered different from each other. You can see this in the following example:

const foobar = 1;
const fooBar = 2;
const Foobar = 3;
const FooBar = 4;
const FOOBAR = 5;

console.log(foobar); // 1
console.log(fooBar); // 2
console.log(Foobar); // 3
console.log(FooBar); // 4
console.log(FOOBAR); // 5

This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.