Interview Q&A / JavaScript

INTERVIEW Q&A · 71 QUESTIONS

JavaScript interview questions

Closures, the event loop, this, promises and the core language questions every frontend round asks.

  1. How does Array.reduce work, and why should you give it an initial value?

    reduce walks the array carrying an accumulator: each callback call gets the accumulator and the current item and returns the next accumulator. Without an initial value, an empty array throws a TypeError.

    BeginnerQuick answer1 min read