Part 4/10:
Question 6: What's the difference between null and undefined in JavaScript?
null
signifies an intentional absence of a value, while undefined
indicates a variable that has been declared but not assigned a value. Understanding this distinction is crucial for debugging and application logic.
Event Propagation
Question 7: Describe the difference between event bubbling and event capturing.
In event bubbling, the event starts from the target element and propagates up to the root, whereas in event capturing, it begins from the root and goes down to the target. Knowing how these event phases work is essential for event handling in JavaScript.
Call, Apply, and Bind
Question 8: What is the difference between call, apply, and bind in JavaScript?