← BYTES
JavaScript·Intermediate·Ref: 3.2.10
What is the purpose of default parameter values in a function declaration, e.g. `function f(x = 10) {}`?
Have a question about this video? Mention reference 3.2.10 when you contact us.
a.They make the parameter mandatory
b.They convert the parameter into a constant inside the function
c.They only work for the first parameter in a function
d.They supply a fallback value used only when the corresponding argument is omitted or explicitly passed as `undefined`
A default parameter value is substituted whenever the caller omits that argument entirely, or explicitly passes `undefined` for it -- but NOT when `null` or any other falsy value is passed, which is still used as-is.
Find this on YouTube & Instagram
Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:
#BYTES#BYTES3210#JavaScript