I understand that functions in JavaScript can take any number of arguments.
- Yes! And it won't complain like ruby about the number of arguments.
I can describe the similarity between blocks in Ruby and anonymous functions in JavaScript.
- The proc that you pass into an enumerable in Ruby is very similar to an anonymous function. Both are telling the computer what to do to the local variables within that block.
Where are the methods available to all arrays (e.g. forEach
, map
, etc.) defined?
- Mozilla Developer Network docs.
I can explain the difference between using a for
loop and the forEach
method.
forEach
will scope the local variables defined for the anonymous function, whereas local variables infor
are actually accessible outside the loop. Also,forEach
is easier to read.
I can explain the difference between forEach
and map
.
- Just like in ruby,
map
will return an array of the transformed elements (as long as you includereturn
!), whereas forEach will not.
Can you explain the process of taking a plain JavaScript objects, transforming them into DOM nodes, and appending them to the page.
- Yes, you'll need to create an element for the document with a certain html tag, then assign it certain attributes, and then append them to the page with
.append()
How comfortable are you using the forEach()
method?
- Very comfortable
How comfortable are you using the map()
method?
- Very comfortable
How comfortable are you using the filter()
method?
- Comfortable
How comfortable are you using the reduce()
method?
- Comfortable
How comfortable are you using the sort()
method?
- So-so, though after looking at the MDN docs I feel better.
How comfortable are you working with simple unit tests in Mocha in the browser?
- Seems straightforward enough, but I'd need to try it out myself to be sure.