Areas I need to understand more deeply: §
- The JS event loop and call stack
- Higher order functions and their implementation
- React Router
- middleware (design patterns)
- Algorithms
- Leetcode fundamentals
- Mastering common data structures:
- Set
- Map/Reduce
- Queues
- LinkedLists
- Revision on how authentication works with JWT
- webSockets fundamentals
- React:
- custom hooks (how to create them and use them)
- useContext
- useMemo
- server actions
- Working with Classes in Javascript
- constructor
- this() function
- can you understand this fully and why Solution Two is so much better?
// Solution One
class PriorityQueue {
constructor() {
this.items = [];
}
enqueue(item, priority) {
this.items.push({ item, priority });
this.items.sort((a, b) => a.priority - b.priority);
}
dequeue() {
return this.items.shift().item;
}
}
// Solution Two
class PriorityQueue {
queues = new Map<number, any[]>()
.set(0, [])
.set(1, [])
.set(2, []);
queue(priority: number, item: any): PriorityQueue {
this.queues.get(priority).push(item);
return this;
}
dequeue(priority: number): any {
const queue = this.queues.get(priority);
const value = queue.shift();
this.queues.set(priority, queue);
return value;
}
}