是否可以在没有()的情况下调用javascript函数;

是否可以在没有()的情况下调用javascript函数;

问题描述:

我的老师告诉我,可以在没有();的情况下调用javascript函数,但我无法弄清楚如何做到这一点。  有没有人对此有所了解? 

My teacher told me it's possible to invoke a javascript function without ();, but I cannot figure out how to do it.  Could anyone shed some light on this? 

JavaScript中的每个函数都是一个对象,当你调用没有()的函数时,你将它作为一个对象访问。

Every function in JavaScript is an object and when you call the function without () you are accessing it as an Object.

如果你的函数名是X()。您可以键入X.然后将列出该函数的属性和方法列表,因为它是一个对象并从另一个对象继承。这就是我们将JavaScript中的函数视为该语言的核心功能的原因。

If your function name is X() . You can type X. then a list of properties and methods will be listed for the function as it is an object and inherit from another objects. This why we consider functions in JavaScript as a core feature of the language.