Javascript
Apr 17, 2026
What is the output?
const add = (a, b = 10) => a + b
console.log(add(5))
console.log(add(5, undefined))
console.log(add(5, null))
Explanation
Default params activate when argument is undefined. null is NOT undefined.
📝
Reviewed by CodeShot Editorial
Every challenge is code-reviewed by senior developers to ensure accuracy and real-world relevance. Learn more.