while using multiple parameter user defined functions in javascript, how can any missing parameter be set to a default value? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

while using multiple parameter user defined functions in javascript, how can any missing parameter be set to a default value?

While defining a user defined function in JS, we can use multiple parameters while declaring. While calling the function, if any one of the parameters are missing, how can I define a default value to the function so that it will not show an error for missing parameter?

13th Aug 2017, 6:29 PM
Mohiuddin Alamgir
Mohiuddin Alamgir - avatar
1 Answer
+ 2
function sup (myparam = theValue){ }
13th Aug 2017, 8:24 PM
Rrestoring faith
Rrestoring faith - avatar