What is tail call optimization in JavaScript?
a) A method where the last function call is optimized to prevent stack overflow
b) A method that increases the call stack size
c) A technique to sort elements faster
d) A function to prevent recursion
Answer:
a) A method where the last function call is optimized to prevent stack overflow
Explanation:
Tail call optimization is a technique used in JavaScript to optimize recursive functions. When the last action of a function is a call to another function, JavaScript can optimize it to prevent stack overflow by reusing the stack frame for the next function call.