Group 3 Java
Group 3 Java
Group 3 Java
All JavaScript identifiers are case-sensitive. This means that language key
words, variables, function names must always be typed with a consistent
capitalization of letters.
For example lastName and lastname, are two different variables but can be
the same for non case sensitive language:
lastName = "Doe";
lastname = "Peterson";
JavaScript Display Possibilities Forexample
Variables are containers for storing data which are declared in 4 ways;
Automatically
Using Var
Using let
Using const
NB. Let cannot be used without declaring it a gain whereas var can be used without
declaring again.
X = 5; Automatically declared
Var X = 5
Let X = 5
Const X= 5
JavaScript comments can be used to explain JavaScript code and to make it
more readable.
JavaScript comments can also be used to prevent execution when testing
alternative code.
Use else to specify a block of code to be executed, if the same condition is false
Use else if to specify a new condition to test, if the first condition is false
Use the else if statement to specify a new condition if the first condition is false.
JavaScript Loops
Loops are handy if you want to run the same code over and over again, each time with a different value.
do/while - also loops through a block of code while a specified condition is true
The For Loop
The for statement creates a loop with 3 optional expressions:
}
From the example, you can read:
Expression 1 sets a variable before the loop starts (let i = 0).
Expression 2 defines the condition for the loop to run (i must
be less than 5).
Expression 3 increases a value (i++) each time the code block
in the loop has been executed.
JavaScript operators
JavaScript operators are used to perform
different types of mathematical and logical
computations.
Examples:
The Assignment Operator = assigns values
The Addition Operator + adds values
The Multiplication Operator * multiplies
values
The Comparison Operator > compares
values
References
https://www.w3schools.com/js/
https://www.javascript.com/
https://geobgu.xyz/web-mapping2/javascript-interactivity.html