Observer pattern

basic

The best way to prepare for JavaScript coding questions is to get your hands dirty by implementing them yourself and writing test cases for them.

Although the focus of such questions is not on algorithms, do pay attention to choice of data structures and the time complexity as well. Don't write a function that runs in O(n<sup>2</sup>) if it can pretty easily have an O(n) runtime with the use of hash maps.

Candidates are expected to take just around 10-15 minutes for a basic question. If you can tell that you received a basic question, try to finish within the suggested duration and do not intentionally take the entire interview to do one question. In most cases, you are expected to answer another coding question.

say it first

Answer it out loud, in your own words. Then compare.

Interviewers listen for how you get there, not only where you land. The answer opens once you have tried.