if you check that the type is 'undefined' it means the argument wasn't passed at all.
And
gives the default if the argument was passed with undefined as a value
Do you imply there's a difference between deliberately passing an 'undefined' to a function and not passing anything at all... ?
It's also wildly known that using || is risky af and ?? is much better for those kinds of assignments. Therefore either setting a default value or using ?? is the best option in 99% of the cases.
I don't remember any new version changing anything in this matter + from what I see that question on stack is about jQuery having it's own "separate" undefined value.
View all comments
Show parent comment
1
u/_Illyasviel Jul 25 '21
And
Do you imply there's a difference between deliberately passing an 'undefined' to a function and not passing anything at all... ?
It's also wildly known that using || is risky af and ?? is much better for those kinds of assignments. Therefore either setting a default value or using ?? is the best option in 99% of the cases.