Javascript function call with/without parentheses

后端 未结 6 1770
南旧
南旧 2021-02-11 07:39

code_0:

(calling foo without parentheses)

function foo(){
    console.log(\'hello world\');
}

setTimeout(foo, 2000);

This

6条回答
  •  闹比i
    闹比i (楼主)
    2021-02-11 08:16

    Here's an easy solution. You can use parentheses and pass data to the function if needed.

提交回复
热议问题