Skip to content

Instantly share code, notes, and snippets.

@jwperry
Created March 24, 2016 21:40
Show Gist options
  • Save jwperry/21d2a97e223aa2f429f4 to your computer and use it in GitHub Desktop.
Save jwperry/21d2a97e223aa2f429f4 to your computer and use it in GitHub Desktop.
JP-understanding-check

Array Prototype Methods

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

    • Yes, and arguments may be omitted.
  • I can describe the similarity between blocks in Ruby and anonymous functions in JavaScript.

    • Yes, they're very similar conceptually. Both take in some data, perform logic on it, and give a return value.
  • Where are the methods available to all arrays (e.g. forEach, map, etc.) defined?

    • In the Array.prototype.
  • I can explain the difference between using a for loop and the forEach method.

    • While functionally they can achieve generally the same thing, the 'for' loop is sloppier with scope ('i' for example).
  • I can explain the difference between forEach and map.

    • Map actually returns a new array based on the logic in the function without transforming the original array (as in Ruby).
  • Can you explain the process of taking a plain JavaScript objects, transforming them into DOM nodes, and appending them to the page.

    • .createElement will allow you to create/format as needed, and using .append() will allow you to add your new elements to the page easily.
  • How comfortable are you using the forEach() method?

    • Fairly comfortable. Sometimes I struggle with scope still, but this feels a lot like Ruby.
  • How comfortable are you using the map() method?

    • Same as above. Feels like a familiar tool.
  • How comfortable are you using the filter() method?

    • Pretty comfortable. Feels like Ruby's .select in spirit, although it doesn't function exactly the same way.
  • How comfortable are you using the reduce() method?

    • Moderately comfortable. The syntax feels odd to me, but after using it a few times it's not bad. This is a tool that I don't reach for frequently enough.
  • How comfortable are you using the sort() method?

    • Pretty comfortable. I actually used this in my IdeaBox before this lesson.
  • How comfortable are you working with simple unit tests in Mocha in the browser?

    • Not very comfortable. I'm generally having problems with all aspects of testing in JavaScript.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment