12. NOT A NUMBER
NaN
NaN is a numeric value that represents something that
is...not a number
ex : 10/0
13. Variables
VARIABLES ARE LIKE LABELS
FOR VALUES
• We can store a value
and give it a name so
that we can:
• Refer back to it later
• Use that value to
do...stuff
Num
of
Votes
72
23. CONDITIO
NALS
What do we choose?
Sleep or Play?
How should we do?
Go or Stop?
Making Decisions With Code
Which one prettier?
Dian Sastro or Pevita
Pearce
29. TRUTHY AND FALSY
VALUES
• All JS values have an inherent truthyness or
falsyness about them
• Falsy values:
⚬ false
⚬ 0 "" (empty string) null
⚬ undefined
⚬ NaN
• Everything else is truthy!
37. LOOPS
Loops allow us to repeat code
• "Print 'hello' 10 times
• Sum all numbers in an array
There are multiple types:
• for loop
• while loop
• for...of loop
• for...in loop
54. FUNCTIONS
A function definition (also called a function
declaration, or function statement) consists of the
function keyword, followed by :
• the name of function
• a list of parameters to the function, enclosed in
parentheses and separated by commas
• The javascript statements that define the
function, enclosed in curly braces, { /* ... */ }
57. OOP LEARNING
OUTCOMES:
• Understand that in JavaScript most things are objects, and
you've probably used objects every time you've touched
JavaScript.
• Basic syntax: Object literals, properties and methods,
nesting objects and arrays in objects.
• Using constructors to create a new object.
58. Object Basics
• Object-oriented programming (OOP) is a programming
paradigm based on the concept of objects;
• We use objects to model (describe) real-world or abstract
features;
• Objects may contain data (properties) and code (methods). By
using objects, we pack data and the corresponding behavior
into one block;
• In OOP, objects are self-contained pieces/blocks of code;
• Objects are building blocks of applications, and interact with
one another;
• Interactions happen through a public interface (API) :
methods that the code outside of the object can access and