Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save GregoryArmstrong/63006b3f5a3f8f3f3aea to your computer and use it in GitHub Desktop.
Save GregoryArmstrong/63006b3f5a3f8f3f3aea 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.

  • Sure do! Flexibility is cool!

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

  • They are essentially the same. A bit of code which is to be run by the method / function but doesnt need to be accessed outside of it.

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

  • In Array.prototype

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

  • A for loop uses a defined set of starting, stepping and stopping criteria which the loop obeys. forEach is going to iterate over the collection, and run the code in the anonymous function on each element.

I can explain the difference between forEach and map.

  • Similar to Ruby, map will return a new array of the result of the executed function for each element. forEach will iterate over the collection and execute the function, but not automatically create a new array of their return values.

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

  • One would create the javascript objects (in our example tutorial, from a collection), create DOM elements utilizing the information contained in each object per your function and then add them to the DOM in a fashion similar to how we've used JQuery to do it.

How comfortable are you using the forEach() method?

  • Yep, these Javascript methods have some peculiar things occuring with the way JS handles truthy/falsy, but it seems similar enough to ruby to learn quickly with a little practice.

How comfortable are you using the map() method?

  • You betcha'!

How comfortable are you using the filter() method?

  • Pretty comfortable!

How comfortable are you using the reduce() method?

  • The syntax is different enough from ruby's that ill have to reference the docs the first couple times I use it on my own, but it seems familiar enough.

How comfortable are you using the sort() method?

  • As comfortable as a really comfortable thing.

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

  • I'll have to practice the syntax as it seems quite a bit different than minitest or rspec, but should be no problem with practice.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment