Prep
- Skim Javascript Types
- Focus on primitive types
- Skim Basic Math in Javascript
- Skim Standard built in objects
Morning Standup
- Key takeaway from yesterdays class? - what did you work on yesterday? - what are you doing today? - do you have any blocks?1. Handling Errors
Key Takeaways
- syntax errors = code not written correctly
- logic errors = code not working correctly
- use dev tools to check for errors
- console.log() is your best friend for diagnosing errors
2. Useful Javascript Objects
Key Takeaways
- DOM methods like
document.querySelector()
are used by js to interact with html - use innerText over innerHTML (innerHTML can be dangerous)
DOM Node Activity
- In codepen copy some of the variables that you created yesterday into the javascript box
- use
document.querySelector()
with the.innerHTML
,.textContent
, or.innerText
methods to render strings to the html page- note: all 3 of those do slightly different things
3. The Math Object
- Slides begin on slide 12 of the abovelinked deck
Useful Math methods
Math.min()
: find lowest value in a listMath.max()
: find highest value in alistMath.round()
: round a number to nearest integerMath.floor()
: round down to nearest intMath.ceil()
: round up to the nearest intMath.sqrt()
: return square root of a numberMath.pow()
: return value of x to power of yMath.random()
: return a random number between 0 and 1
Numbers and Math in JS
Key Takeaways
Operators
- addition
+
- subtraction
-
- multiplication
*
- division
/
- remainder
%
- exponent
**
- increment
++
- decrement
--
Order of Operations
- Brackets
- Exponents
- Divide/Multiply
- Add/Subtract
Practicum Discussion with Terry @ 12:30
Terry will join us and talk about the practicums with us. Afterwards, we will have open lab time
Today's Achievement
Mini Activity 2: Before and After
- Due:: February 14
- Weight: 10%
- Objective: Lean how to work with javascript variables