Passing a function as an argument in a javascript function

后端 未结 7 1157
眼角桃花
眼角桃花 2020-12-08 00:25

I was wondering whether this is legal to do. Could I have something like:

function funct(a, foo(x)) {
  ...
}

where a is an ar

7条回答
  •  臣服心动
    2020-12-08 01:20

    What you have mentioned is legal. Here, foo(X) will get called and its returned value will be served as a parameter to the funct() method

提交回复
热议问题