What do we discuss in this article?
A] Case Sensitivity
Everything is case-sensitive; variables, function names,and operators are all case-sensitive, meaning that a variable named dog is different from a variable named Dog which is also different from another one named dOg. Similarly, typeof can’t be the name of a function, because it’s a keyword , a word having predefined meaning.
An identifier is the name of a variable, function, property, or function argument. Identifiers may be one or more characters in the following format:
- The first character must be a letter, an underscore (_), or a dollar sign ($).
- All other characters may be letters, underscores, dollar signs, or numbers.
- Letters in an identifier may include extended ASCII or Unicode letter characters such as À and Æ, though not recommended.
- ECMAScript identifiers use camel case, meaning that the first letter is lowercase and each additional word is added such that its first alphabet is capital.
//Notice how first word 'my' is fully small and 'Car' has its 1st alphabet capital. This is called camel case.
//Notice how each word follows camel case
//valid as it begins with _
//valid as it begins with $
//invalid as it begins with a number
//invalid since space cannot be added in between
var our House;
Use // to mark the start of a single line comment.
Use /* */ to mark the start and end of a multi-line comment. Check the example below.
//Make first number as 10
//Make second number as 12
Add 10 and 12
so that sum becomes 22
That’s exactly how you are supposed to add notes in your code files for reference later.
//Notice the semicolons at the end of each statement here