开发者

Skipping arguments in JavaScript

开发者 https://www.devze.com 2022-12-24 17:18 出处:网络
function my_func(a, b){ if(typeof(a) !== \'undefined\'){ // do stuff } return b; } How can I call this function will only the second ar开发者_StackOverflow中文版gument?In other words, I want a to b
function my_func(a, b){
    if(typeof(a) !== 'undefined'){
        // do stuff
    }

    return b;
}

How can I call this function will only the second ar开发者_StackOverflow中文版gument? In other words, I want a to be undefined.


my_func(undefined, b);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号