javascript - How to pass arguments to a function with one passed? (ES6) -




there function 3 arguments set default:

function func( = 1, b = 2, c = 3 ) {     console.log(a, b, c); } 

how pass arguments function 1 passed? example:

func(10, , 30); 

you use undefined, value undefined variables default parameters:

in javascript, parameters of functions default undefined.

the default check works like

b = b !== undefined ? b : 2  

function func(a = 1, b = 2, c = 3) {      console.log(a, b, c);  }    func(10, undefined, 30);





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -