Skip to content

Instantly share code, notes, and snippets.

@harrisonmalone
Last active November 14, 2018 12:42
Show Gist options
  • Save harrisonmalone/60c315dd9da74f49fd2336b66baaa24f to your computer and use it in GitHub Desktop.
Save harrisonmalone/60c315dd9da74f49fd2336b66baaa24f to your computer and use it in GitHub Desktop.

Broswer js

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment