how to skip optional parameter in javascript

Solutions on MaxInterview for how to skip optional parameter in javascript by the best coders in the world

showing results for - "how to skip optional parameter in javascript"
Juan David
18 Jan 2021
1function myfunc(x,y=2,z=6){
2  console.log(x*y);
3  console.log(z);
4}
5myfunc(5) //Output: 10 6
6myfunc(5,4,2) //Output: 20 2
7myfunc(5,undefined,17) //Output 10 17