What is the difference between a function call and function reference?

前端 未结 6 2347
别跟我提以往
别跟我提以往 2020-11-22 05:50

I have the following function

function hello() {
 alert(\"hi!\");
}

Take this piece of code:

var elem = document.getElem         


        
6条回答
  •  无人及你
    2020-11-22 06:06

    How can I know where I'm supposed to give a reference to the function, and when I'm supposed to actually call it?

    Do you need the function to run now?

    Than add the () to execute it

    Do you need to function to be referenced so it is called later?

    Do not add the ().

提交回复
热议问题