Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save danjwinter/3224916475f4bb70e4f5 to your computer and use it in GitHub Desktop.
Save danjwinter/3224916475f4bb70e4f5 to your computer and use it in GitHub Desktop.
Checks for Understanding

Array Prototype Methods

I understand that functions in JavaScript can take any number of arguments.

Indeed.

I can describe the similarity between blocks in Ruby and anonymous functions in JavaScript.

Sure can. They both create IIFEs with local variables that can be used to manipulate whatever is called as a message with the anonymous function. Or not, it totally depends on that anonymous function.

Where are the methods available to all arrays (e.g. forEach, map, etc.) defined?

Array.prototype

I can explain the difference between using a for loop and the forEach method.

A for loop iterates as long as you tell it to. Alternatively, forEach loops for as many times as there are items in the collection on which the method was called.

I can explain the difference between forEach and map.

It's all about those returns.

Can you explain the process of taking a plain JavaScript objects, transforming them into DOM nodes, and appending them to the page.

  1. Use an iterator.
  2. In each iteration, create a DOM element by calling document.createElement(ELEMENT_TYPE_AS_STRING)
  3. Use document.getElementById to find the spot you want to place your new nodes
  4. Call .appendChild(NEW_NODE) on that element.
  5. Cheers your pc.

How comfortable are you using the forEach() method?

Rather.

How comfortable are you using the map() method?

It's just Ruby, right?

How comfortable are you using the filter() method?

Getting a little more tricky but we're cool.

How comfortable are you using the reduce() method?

Love me a little reduce, though I'm sure I could be more efficient.

How comfortable are you using the sort() method?

Lexical sorting? Ain't that something. Really tempted to monkey patch it by default in all my projects to look for numbers and take that into account when sorting but I can live with it. And Use it. Comfortably-ish.

How comfortable are you working with simple unit tests in Mocha in the browser?

Well....I can work through that tutorial but haven't had any practice writing the tests or and my debugging just isn't at the same level as my Ruby debugging. Could definitely use more resources and could spend more time solidifying.

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