April 12, 2023 Training

Frontend Web Development Bootcamp Course by FreeCodeCamp

(cont. from yesterday)

When in the console, using the up arrow with retrieve the last command you used and you can cycle through them this way

Let is how you set variables that may change (I think I forgot to write that down yesterday)

Example: your name will probably stay the same but the date you agree to the terms and conditions may change

Arithmetic Operators (table from W3 schools)

OperatorDescription
+Addition
Subtraction
*Multiplication
**Exponentiation (ES2016)
/Division
%Modulus (Remainder)
++Increment
Decrement

Comparison Operators (equal is not part of this list, table from W3 schools)

OperatorDescription
==Equal to
===Equal value and equal type
!=Not equal
!==Not equal value or equal type
>Greater than
<Less than
>=Greater than or equal to
<=Less than or equal to

In the following example, we set what we want the variable to be even though we don’t “know” it at the time. The (20 === 20) is what determines what the response to the variable will be using if and else statements with corresponding strings.

let = resultVariable;

If (20 === 20) {

resultVariable = ‘variables match’;

} else {

resultVariable = ‘variables do not match’;

}

Logical Operators

OperatorDescription
&&And
||Or
!Not

Use these in between other problems in order to determine if something meets all of the criteria

It is helpful to think of longer sequences as broken down into its specific steps first to ensure that 1) everything works right 2) that I properly understand the sequence 3) that I continue to understand the sequence when I look at code written months prior

Loops exist to complete processes where a step is repeated multiple times instead of manually completing those steps each time (use for())

This is where the operators like ++ and <> really come into play since you can’t know what every value is at every moment

If you want it to write every part of an array, you can use for (let i = ; i < arr.length)

How do you replace a variable you set as constant?

variableName.replace(‘variableNameToBeReplaced’, ‘newVariableName’);

There’s no reason to have every command memorized! That’s what documentation is for. You’ll learn and remember what is most relevant for you to know

A lot of handling of data in JS is breaking that data into its most basic and malleable bits and then working with those bits