Kursinhalt
Introduction to JavaScript (staging)
Introduction to JavaScript (staging)
2. JavaScript syntax
JavaScript SyntaxJavaScript VariablesJavaScript OperatorsIdentifiers in JavaScriptNaming IdentifiersReserved keywords in JavaScriptNaming Convention in JavaScript. Case StylesVariables Naming ConventionBoolean Naming ConventionConstant Naming ConventionFunction & Classes Naming ConventionMultiline StringsMultiline Strings. ConcatenatingCommenting in JavaScriptCommenting in JavaScript. Multi-line Comments
3. Data Types and Variables
What are Variables?What are Data-types?JavaScript and Type ConversionVar 1/3Var 2/3Var 3/3Let 1/2Let 2/2Constant 1/3Constant 2/3Constant 3/3Number 1/3Number 2/3Number 3/3Boolean 1/4Boolean 2/4Boolean 3/4Boolean 4/4Strings 1/5Strings 2/5Strings 3/5Strings 4/5Strings 5/5BigInt 1/3BigInt 2/3BigInt 3/3Symbols 1/3Symbols 2/3Symbols 3/3NullUndefinedNull vs Undefined
Naming Identifiers
Good practices for naming identifier
- Though you can name identifiers in any way you want, it’s a good practice to give a descriptive identifier name.
- Names should be logical.
- If you are using an identifier for a variable to store the number of students, it is better to use
students
,numberOfStudents
, ornumber_of_students
rather thanx
orn
.
//valid but not preferable let n = 10; console.log(n); // clear and descriptive name let numberOfStudents = 10; console.log(numberOfStudents); //clear and descriptive name let number_of_students = 10; console.log(number_of_students);
In both cases, the output is the same but the second and the third identifiers are more meaningful.
Aufgabe
Swipe to start coding
Declare a variable, using the const
keyword, with the identifier numberOfEmployees
and assign the value 50
to that variable and print the value of the variable on the console using the console.log()
function.
Lösung
Summary
- Identifiers are names for the variables, arrays, functions, objects, and classes.
- The identifier should follow the above rule.
- Identifiers should have descriptive names.
War alles klar?
Danke für Ihr Feedback!
Abschnitt 2. Kapitel 5
Naming Identifiers
Good practices for naming identifier
- Though you can name identifiers in any way you want, it’s a good practice to give a descriptive identifier name.
- Names should be logical.
- If you are using an identifier for a variable to store the number of students, it is better to use
students
,numberOfStudents
, ornumber_of_students
rather thanx
orn
.
//valid but not preferable let n = 10; console.log(n); // clear and descriptive name let numberOfStudents = 10; console.log(numberOfStudents); //clear and descriptive name let number_of_students = 10; console.log(number_of_students);
In both cases, the output is the same but the second and the third identifiers are more meaningful.
Aufgabe
Swipe to start coding
Declare a variable, using the const
keyword, with the identifier numberOfEmployees
and assign the value 50
to that variable and print the value of the variable on the console using the console.log()
function.
Lösung
Summary
- Identifiers are names for the variables, arrays, functions, objects, and classes.
- The identifier should follow the above rule.
- Identifiers should have descriptive names.
War alles klar?
Danke für Ihr Feedback!
Abschnitt 2. Kapitel 5