# | Category | # | Questions |
---|---|---|---|
1 | Utility | 1 | 1. Implement curry() |
2 | 2. Implement curry() with placeholder support | ||
3 | 3. Implement Array.prototype.flat() | ||
4 | 4. Implement basic throttle() | ||
5 | 5. Implement throttle() with leading & trailing option | ||
6 | 6. Implement basic debounce() | ||
7 | 7. Implement debounce() with leading & trailing option | ||
8 | 11. Implement pipe() | ||
9 | 12. Implement Immutability helper | ||
10 | 14. Implement memo() | ||
11 | 15. Implement jQuery DOM wrapper | ||
12 | 17. Create a simple store for DOM element | ||
13 | 20. Detect data type in JavaScript | ||
14 | 22. Implement JSON.parse() | ||
15 | 23. Create a sum() | ||
16 | 24. Create a Priority Queue in JavaScript | ||
17 | 26. Implement Object.assign() | ||
18 | 46. Implement _.once() | ||
19 | 54. Flatten Thunk | ||
20 | 63. Create _.cloneDeep() | ||
21 | 69. Implement deep equal _.isEqual() | ||
22 | 85. Implement _.get() | ||
23 | 122. Implement memoizeOne() | ||
24 | 125. Implement classNames() | ||
2 | DOM Manipulation | 1 | 19. Find corresponding node in two identical DOM tree |
2 | 58. Get DOM tree height | ||
3 | 68. Get DOM tags | ||
4 | 89. Next Right Sibling | ||
5 | 104. Traverse DOM level by level | ||
6 | 113. Virtual DOM I | ||
7 | 118. Virtual DOM II - createElement | ||
3 | Async Utility | 1 | 29. Implement sequence() |
2 | 30. Implement parallel() | ||
3 | 31. Implement race() | ||
4 | 56. Call APIs with pagination | ||
5 | 101. Merge identical API calls | ||
4 | Promise | 1 | 32. Implement Promise.all() |
2 | 33. Implement Promise.allSettled() | ||
3 | 34. Implement Promise.any() | ||
4 | 35. Implement Promise.race() | ||
5 | 64. Auto-retry Promise on rejection | ||
6 | 67. Create your own Promise | ||
7 | 92. Throttle Promises | ||
8 | 123. Implement Promise.prototype.finally() | ||
5 | Timer | 1 | 28. Implement clearAllTimeout() |
2 | 36. Create a fake timer (setTimeout) | ||
3 | 83. Create an interval | ||
4 | 84. Create a fake timer (setInterval) | ||
5 | 130. Create LazyMan() | ||
6 | Implement a stopwatch | ||
6 | Sorting | 1 | 40. Bubble Sort |
2 | 41. Merge Sort | ||
3 | 42. Insertion Sort | ||
4 | 43. Quick Sort | ||
5 | 44. Selection Sort | ||
7 | HTML manipulation | 1 | 55. Highlight keywords in HTML string |
2 | 99. Extract all anchor element form HTML string | ||
8 | Browser | 1 | 59. Create a browser history |
2 | 80. Implement your own URLSearchParams | ||
3 | 117. Event Delegation | ||
4 | 134. Create your own Cookie | ||
5 | 135. localStorage with expriration | ||
9 | PubSub | 1 | 16. Create an Event Emitter |
2 | 56. Create an Observable | ||
3 | 71. Implement Observable Subject |
# | Question | Pure JS | React | React Testing | Fetch data | Trasition |
---|---|---|---|---|---|---|
1 | Light out game | ✓ | ✓ | @TODO | @TODO | @TODO |
2 | Calendar | ✓ | ✓ | ✓ | @TODO | @TODO |
3 | Tic Tac Toe Game | @TODO | ✓ | @TODO | @TODO | @TODO |
4 | Star rating | - | - | - | - | @TODO |
5 | Poll | @TODO | ✓ | @TODO | ✓ | @TODO |
6 | Light box | @TODO | ✓ | @TODO | ✓ | @TODO |
7 | Click outside to close drop down | @TODO | ✓ | ✓ | ✓ | @TODO |
8 | Accordion | @TODO | @TODO | @TODO | @TODO | @TODO |
9 | Carousel | @TODO | ✓ | @TODO | ✓ | @TODO |
10 | Download Progress bar | @TODO | @TODO | @TODO | @TODO | @TODO |
11 | Toast Notification | @TODO | ✓ | @TODO | ✓ | @TODO |
12 | Snake Game | @TODO | @TODO | @TODO | @TODO | @TODO |
13 | Excel table (calculated cell, sort, filter) | @TODO | @TODO | @TODO | @TODO | @TODO |
14.a | Todo app CRUD | @TODO | ✓ | @TODO | ✓ | @TODO |
14.b | Render JSON server data | @TODO | @TODO | @TODO | @TODO | @TODO |
14.c | Infinite scroller | @TODO | @TODO | @TODO | @TODO | @TODO |
14.d | File uploader | @TODO | @TODO | @TODO | @TODO | @TODO |
14.e | Pagination | @TODO | @TODO | @TODO | @TODO | @TODO |
14.f | Autocompcdlete | @TODO | ✓ | @TODO | @TODO | @TODO |
14.g | Fuzzy search | @TODO | ✓ | @TODO | @TODO | @TODO |
- Load initial page with placeholder on secondary contents.
- Finish loading all secondary contents.
- Hydration.
- Load initial page with placeholder on secondary contents.
- Finish loading first secondary content.
- Progressive hydration with React Concurrent Mode.
const GetPostList = async () => {
const response = await fetch('http://hostname/api/posts/');
const data = await response.json();
return data;
}
React.createElement(componentName, props: attribute | eventListener, ...children): virtualElement
function({props}) {
let state = {};
return virtualElement;
}
interface {
key: 'unique key',
props: {
children: [children node],
eventListener: () => {}
},
ref: 'actual DOM',
type: 'ComponentName'
}
- atom:
const countAtom = atom(0);
const [count, setCount] = useAtom(countAtom);
- pipe:
const countAtom1 = atom(1);
const countAtom2 = atom(2);
const countTotalAtom = atom(get => get(countAtom1) + get(countAtom2));
-
createNodeFromTypeAndProps(virtualElement) => LinkedListNode
-
updateHostComponent(current, workInProgress)
-
Linked List Node:
interface {
stateNode: new ComponentName,
type: 'ComponentName',
alternate: 'WorkInProgress Node',
key: 'unique key',
updateQueue: [],
memoizedState: {},
pendingProps: {
children: [children node],
eventListener: () => {},
},
memoizedProps: {
children: [children node],
eventListener: () => {},
},
tag: number,
effectTag: number,
nextEffectTag: number
}
- Phases:
-
Render Phase:
Run
updateHostComponent(current, workInProgress)
-
Commit Phase:
Traverse effect list to perform DOM mutation and async request. Start when
- After component mounted
- After component updated
- Before component unmounted
-
-
Seperation of Concerns
-
Command-Query separation
-
Optimized for Change
-
View/component
-
Functionality/jotai
-
Connection 3.1 Long/short polling (client pull): Command/Query warpper + Async request function 3.2 WebSockets (server push): WebSocket 3.3 Server-Sent events (server push): new EventSource()
-
Gateway API: Read server Write server
- Twitter/Facebook/Instagram (User, Post, Friendship, Media)
- WhatsApp (Real time Chat service, User, Message, Frinedship, Status, Channel)
- Netflix (Real time stream service, Video)
- Pinterest (Image sharing service)