Algorithms and Data Structures · Middle · Question 12 of 75
Does JavaScript have a built-in priority queue?
- 1Yes,
Array.prototype.sortkeeps arrays as heaps - ✓Correct answer: No, you write a heap yourself or use a library
- 3Yes,
Maporders its keys by priority
Explanation
There's no built-in heap in JavaScript. Map keeps insertion order, not priority. In interviews you either implement a small binary heap or explain that you'd use one from a library.