3 ms·
Yup, you're absolutely correct. Null is considered a valid value for a default param. function test(a = 1) { console.log(a) } test() // -> 1 is pri
by horsawlarway 6y ago
Yup, you're absolutely correct. Null is considered a valid value for a default param.
function test(a = 1) {
console.log(a)
}
test() // -> 1 is printed
test(null) // -> null is printed
test(undefined) // -> 1 is printed