Blog 204

Sam Dunegan
1 min readFeb 11, 2021
  1. Describe one thing you’re learning in class today. Today I learned about higher-order functions and how to use them to find different things in an array.
  2. Can you describe the main difference between a forEach loop and a .map() loop and why you would pick one versus the other? The forEach method is used to preform logic on every array element while the .map() method is used to create a new array that is, in some way, a transformation of an existing array. The forEach method will never be assigned to a new variable because it will return undefined. The .map() method can create a new variable that will be used when returned with each element in an array.
  3. Describe event bubbling. When one element is nested inside another element and both elements have registered a listener for the same event.
  4. What is the definition of a higher-order function? Is a function that can take another function as an argument, or that returns a function as a result.
  5. ES6 Template Literals offer a lot of flexibility in generating strings. Can you give an example? It makes it easier to change a variable in a string aswell as navigate through the strings.
  6. What Is an associative array in JavaScript? Objects where indexes are replaced by user defined keys.
  7. Why should you never use new Array in JavaScript? A new array has more code to transfer over and more to parse when using the terminal.

--

--