Engrain by ByteRush

JS.15.02 Mid-levelCore — asked often

Array map, filter, reduce, forEach

Comes up in: Coding

This concept is being written. It gets the full five steps — explanation, predict, interview angle, practice with tests, and review cards. Here is exactly what it will cover, so you can study it elsewhere in the meantime.

What it covers

  • callback arguments (value, index, array)
  • thisArg
  • sparse arrays (holes skipped)
  • reduce without initial value and empty array TypeError

Words you will know

sparse arrayaccumulator

What you will practise

  • implement four methods

Interview questions this answers

  • Write a polyfill for Array.prototype.reduce. What happens with an empty array and no initial value?