Back to Course

Introduction to JavaScript

0% Complete
0/0 Steps
  1. JavaScript: Basics
    9Topics
    |
    10 Quizzes
  2. JavaScript: Variables
    9Topics
    |
    10 Quizzes
  3. JavaScript: Conditional Statements
    10Topics
    |
    11 Quizzes
  4. JavaScript: Functions
    10Topics
    |
    11 Quizzes
  5. JavaScript: Scope
    6Topics
    |
    7 Quizzes
  6. JavaScript: Arrays
    11Topics
    |
    12 Quizzes
  7. JavaScript: Loops
    8Topics
    |
    9 Quizzes
  8. JavaScript: High Order Functions
    3Topics
    |
    3 Quizzes
Lesson 4, Topic 3
In Progress

JavaScript: Calling a Function

Yasin Cakal 5 Nov 2021
Lesson Progress
0% Complete

A function declaration binds a function to an identifier, just as we learned in previous exercises.

A function declaration, on the other hand, does not request that the code inside the function body run; instead, it simply declares the existence of the function. The code within a function body is only executed when the function is called

To call a function in your code, type the function name followed by parentheses. Consider the following example:

helloWorld();
function helloWorld() {
    console.log("Hello,World!");  
}

// Output: Hello,World!

In the code above ,the statement helloWorld(); is there to call the function. This function call executes the function body, or all of the statements in the function declaration between the curly braces.The same function can be called as many times as necessary.

Responses

Leave a Reply

%d bloggers like this: