Web Developer Bootcamp
JavaScript
Basics
VALUES & VARIABLES
JS-LAND
PLEASE GIVE ME
GOOGLE.COM/SEARCH?Q=CHICKENS
HANG ON
HERE YOU GO!
FRONT END BACK END
THE
PURPLE CSS - adjectives
DINO
HTML - nouns
DANCED JS - verbs
LEARN JS ON
ITS OWN. NO
HTML/CSS.
USE JS TO
MANIPULATE
HTML/CSS
Primitive Types
THE BASIC BUILDING BLOCKS
Number
String
Boolean
Null
Undefined
* Technically there are two others: Symbol and BigInt
DIFFERENT DATA TYPES
Running Code
in The Console
THE EASIEST PLACE TO START
Early on, we'll run our code using the
Chrome developer tools console. Then,
we'll learn how to write external scripts.
Numbers
IN JAVASCRIPT
JS has one number type
Positive numbers
Negatives numbers
Whole numbers (integers)
Decimal numbers
Math Operations
// creates a comment
(the line is ignored)
NaN
NOT A NUMBER
NaN is a numeric value that represents
something that is...not a number
Not A Number
// creates a comment
(the line is ignored)
WHAT DOES THIS
EVALUATE TO??
4 + 3 * 4 / 2
WHAT DOES THIS
EVALUATE TO??
4 + 3 * 4 /
(13 % 5) ** 22
WHAT DOES THIS
EVALUATE TO??
Variables
VARIABLES ARE LIKE
LABELS FOR VALUES
N
Up um We can store a value and give it
vo
72 te
s
a name so that we can:
Refer back to it later
Use that value to do...stuff
Or change it later one
BASIC SYNTAX
let someName = value;
BASIC SYNTAX
let year = 1985;
Make me a variable called "year" and give it the value of 1985
RECALL VALUES
RECALL VALUES
This does not change the
value stored in hens
This does!
CONST
const works just like
let, except you CANNOT
change the value
NOT ALLOWED!
YOU'RE IN TROUBLE!!
I'M TELLING MOM!!!
WHY USE CONST?
Once we cover Arrays & Objects, we'll see other
situations where const makes sense over let.
VAR
THE OLD VARIABLE KEYWORD
BEFORE LET & CONST, VAR WAS THE ONLY
WAY OF DECLARING VARIABLES. THESE DAYS,
THERE ISN'T REALLY A REASON TO USE IT.
What is the value of
totalScore?
What is the value of
totalScore?
What is the value of
temperature?
What is the value of
bankBalance?
BOOLEANS
TRUE or FALSE
Booleans
TRUE OR FALSE
Booleans are very simple.
You have two possible options: true
or false. That's it!
Variables Can Change Types
It doesn't really make sense to change from
a number to a boolean here, but we can!