javascript 101 - class 2
TRANSCRIPT
1. Refresher 2. Array Basics 3. Loops 4. Control Flow
Data types
Data types
Number!42
Data types
Number!42
Float!867.5309
Data types
Number!42
Float!867.5309
String!“Hey, Jude”
Data types
Number!42
Float!867.5309
String!“Hey, Jude”
Boolean!true
Variables
Functions
1. Refresher 2. Array Basics 3. Loops 4. Control Flow
What is an Array and why do I care?
An array can be stored as a variable
How do I access just one value?
Array indices
How do I tell how many items are in there?
Exercise
Create an Array with any values and assign it to a variable.!
RTFG (read the freaking google) and find out how to delete an item from a JavaScript array.
1. Refresher 2. Array Basics 3. Loops 4. Control Flow
“for” loops
Remember this array?
How can we “iterate” through this Array and print
out all of the values?
Exercise
Use the knowledge you have learned today to:!
create an Array of items and assign it to a variable!
“iterate” through each item and delete it from the array!
check the value of your variable you created for the Array. What does it return?
“while” loops
Remember this for loop?
Now, as a while loop…
“for” and “while” loops are two different ways of accomplishing
the exact same thing.
Exercise
Convert your “for” loop from the previous exercise to a “while” loop and make sure it has the exact same output as before.!
If you forgot…!
create an Array of items and assign it to a variable!
“iterate” through each item and delete it from the array!
check the value of your variable you created for the Array. What does it return?
1. Refresher 2. Array Basics 3. Loops 4. Control Flow
No slides allowed here. Learn to RTFG.
if!
else if!
else!
“switch” statement!
logical operators