freeCodeCamp Challenge Guide: Understanding Case Sensitivity in Variables

freeCodeCamp Challenge Guide: Understanding Case Sensitivity in Variables
0

#1

In JavaScript all variables and function names are case sensitive. This means that capitalization matters.

MYVAR is not the same as MyVar nor myvar. It is possible to have multiple distinct variables with the same name but different casing. It is strongly recommended that for the sake of clarity, you do not use this language feature.

Best Practice

Write variable names in Javascript in camelCase. In camelCase, multi-word variable names have the first word in lowercase and the first letter of each subsequent word is capitalized.

Examples:

var someVariable;
var anotherVariableName;
var thisVariableNameIsTooLong;

This is the right answer:

studlyCapVar = 10;
properCamelCase = “A String”;
titleCaseOver = 9000;

studlyCapVar = 10;“camelCase”;
titleCaseOver = 9000;“camelCase”;

===========================
Try this one

var camelCase;//someVariable;
var anotherVariableName;
var thisVariableNameIsTooLong;
var properCamelCase;
var titleCaseOver;
// This is the right answer:

studlyCapVar = 10;
properCamelCase = “A String”;
titleCaseOver = 9000;

studlyCapVar = 10;
titleCaseOver = “camelCase”;
titleCaseOver = 9000; //“camelCase”;

Error: titleCaseOver should use camelCase in both declaration and assignment sections.


#2

I got confused with this one too…

all you have to do is correct the uppercase and lowercase


#4

I will figure this out, but the instruction for this one is really confusing, once i figure this out please reword your instructions. thank you. KuDOS in all of you!


#5

Camel case (stylized as camelCase or CamelCase; also known as camel caps or more formally as medial capitals) is the practice of writing compound words or phrases such that each word or abbreviation in the middle of the phrase begins with a capital letter, with no intervening spaces or punctuation.