Use defined functions part 4

JavaScript Tutorial
Functions
User-Defined Functions
1
4/4
               

Calling Functions



Once the function is defined, JavaScript allows you to call it as many times as you want to.
function myFunction() {
alert("Alert box!");
}

myFunction();
//"Alert box!"

// some other code

myFunction();
//"Alert box!"
Try It Yourself

You can also call a function using this syntax: myFunction.call(). The difference is that when calling in this way, you're passing the 'this' keyword to a function. You'll learn about it later.
How many times can the function be executed inside a web page?
As many as needed
2
1024

Comments

Popular posts from this blog

Introducing object part 3

Comparison Operators part 2

Module 2