JavaScript Basics
JavaScript Basics
JavaScript Basics
let ourArray = [“ ”, “ ”, “ ”, “ ”];
Objects
let user = { Access array elements
CHEAT SHEET fullname: “Bucky Barnes”,
age: 40,
ourArray[0]; //
Number if (isRaining){
let num = 3;
wearRainCoat(); Function
} else if (isRainingHeavy){
let floatData = 3.3;
sample function
doNotGoOut();
function sayHi() {
Strings } else {
console.log("Welcome to this Earth!");
const stringVaribale = “hello”; doNotWearRainCoat();
}
}
Arrays
call a function
let fruit = ["Banana", "Apple", "Orange"];
sayHi();
freeze
Scope Object.freeze(user);
Loops *=
/=
Multiplication Assignment
Division Assignment %
/ Division
Remainder
for loop
Objects & it's methods %=
**=
Remainder Assignment
Exponentiation Assignment
**
++
Exponentiation (Power)
Increment (increments by 1)
-- Decrement (decrements by 1)
for (let i = 1; i <= 5; i++) {
The Object
console.log(`This is for loop.`);
let user = { Comparison Operators Bitwise Operators
}
fullname: “Thomas shelby”,
== Equal to & Bitwise AND
place: “birmingham”
while loop != Not equal to | Bitwise OR
} === Strict equal to ^ Bitwise XOR
while (i <= 3) {
!== Strict not equal to ~ Bitwise NOT
console.log(`This is while loop.`);
Access properties > Greater than << Left shift
i += 1; >= Greater than or equal to >> Sign-propagating right shift
console.log(user.fullname);
} < Less than >>> Zero-fill right shift
// Thomas Shelby
<= Less than or equal to
console.log(user.place);
do while loop
// birmingham
do {
console.log(`This is do while loop.`); Logical Operators
entries
i++; && Logical AND
} console.log(Object.entries(user)); || Logical OR