functionmyFunction("Call me maybe",12345,optionals={param4:12356}/** Object */){const{param3,param4}=optionals;//Destructuring//if you console param3, it will show undefined.// Write any code here};myFunction("Called",4123,{param4:67890});
however. For readability, it's better to have a named parameters than to have none. by simply wrapping your parameters as object and destructuring it in a function. It's a good practice to have a named parameters when you don't know what parameters have been provided in a function.
You might be redirected to this page from moseskarunia.com.
Flutter developer, UX designer wanna-be, speciality coffee enthusiast, and also a Christian.
Maybe a typo.
however. For readability, it's better to have a named parameters than to have none. by simply wrapping your parameters as object and destructuring it in a function. It's a good practice to have a named parameters when you don't know what parameters have been provided in a function.
JavaScript Named Parameters
Dale L. Jefferson ・ May 30 ・ 1 min read
Good point! I can see that it can improve readability. Thanks for sharing!