morning challenges
Object.values(obj)
this returns the values of an object
did a recap of js callbacks
looked at various examples of .forEach, .map, .filter etc
// i like to think of forEach like a method call, we pass a function into the method call, when we do this it's known as a callback
arr.forEach(function(element) {
console.log(element)
}
remember a callback is simply a function that's passed as an argument, it's invoked in a special way (js magic)
then looked at browser javascript
did a challenge altering github squares
use things like querySelector and Math.random
also used .forEach
demoed some examples
then we looked at linking javascript in html file
takeaway was that we need the DOM to be fully loaded in order for js to work correctly (do things in console like accessing a const)
can put js under the body but best practice is to use defer
and put javascript into a separate file
had a review class for callbacks
did the event listener challenge with an input and updating the H1
some resources: input event listener mdn, errors in js, understand reduce js function