Animations
API
Arrays
Async
Basics
Challenges
Classes
Console
Dates
Debugging
DOM Elements
DOM Methods
DOM Properties
Event Listeners
Flow Control
Forms
Functions
Global Functions
JSON
Keywords
Libraries (3rd party)
Math
Modules
Objects
Snippets
String
Types
Widgets
Window Object
To invoke
a javascript function, you assign it variable - thus making it an object. Like so: let x = MyFunction();
.
To call
a javascript function, you simply call it in code like so: MyFunction();
.
To make a reference
to a function, you simply use it's name: var myPointer = MyFunction
.
In JavaScript there, is always a default global
object. In HTML the default global object is the HTML page itself, so
the function above "belongs" to the HTML page.
In a browser, the page object is the browser window. The function above automatically becomes a window function. myFunction() and window.myFunction() is the same function.