Introduction To JavaScript
Introduction To JavaScript
CASE SENSITIVITY IN
VARIABLES~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
varnames starts with small letter and next words starts with uppercase
INCREMENTING / DECREMENTING
NUMBERS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FINDING
REMAINDERS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var a = 3;
instead of using a = a + 9, use a += 9; for a shortcut
so,
add +=
sub -=
mult *=
div /=
DECLARE STRING
VARIABLES~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ESCAPING LATERAL
STRINGS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
in order for the string to count as one you should add a backslash(\) to connect
the strings
use a single quote at the beginning and at the end of the string so you can
eliminate tha backslashes before double quotes
or you can use backticks (``)
ESCAPE
SEQUENCES~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Code Outputs:
\' single quote
\" double quote
\\ backslash
\n newline
\r carriage return
\t tab
\b backspace
\f form feed
eg.
var firstNameLength = 0;
var firstName = "Niko";
firstNameLength = firstName.length
console.log(firstNameLength);
RESULT: 4
BRACKET NOTATION~~~~~~~~~~~~~~~~~
firstLetterOfLastName = lastName[0]
console.log(firstLetterOfLastName);
inside the bracket indicates the exact element according to the number
first element always start with 0
STRING IMMUTABILITY~~~~~~~~~~~~~~
firstLetterOfLastName = lastName[lastName.length - 1]
console.log(firstLetterOfLastName);
RESULT: o
WORDBLANKS~~~~~~~~~~~~~~~
return result;
}
console.log(wordBlanks("brilliant", "Niko Andrei", "performing"));
console.log(wordBlanks("smart", "Blaise", "performing"));
ARRAYYS~~~~~~~~~~~~~~~
NESTED ARRAY~~~~~~~~~
var myArray = [["Niko", 17], ["Blaise",17]]
RESULT: 17
RESULT: [17,18,23]
MULTIDIMENSIONAL ARRAY~~~~~
RESULT: [26,27,28]
PUSH()