Functions in JavaScript Updated

Functions in JavaScript are same as any other programming languages. In this article, we are going to discuss functions in depth in javascript. Before you study javascript you need HTML and CSS the reason behind JavaScript is one of the three(HTML, CSS, Javascript) languages that every web designer or developers must learn.

Functions in JavaScript in details with graphical explain.png

What is a Function in Javascript

A function is a block of code which can be reused anywhere in the program. The main benefit of a writing a function is that we didn’t need to write the same block of code again and again. Also, functions give us the modular approach of programming where we can break a large line of code program into small modules. Even JavaScript itself provide modular programming like we have many inbuilt functions which are written once in JavaScript and we can use them anywhere in the program. Being a web designer these Create Profile here for submitting Projects and IDea's.

Table of Content | Javascript Function

  • What is a Function in Javascript

  • Defining a Function in Javascript

  • The syntax of Functions in Javascript

  • Example of a Function in Javascript

  • Explanations of Functions in Javascript

  • Parameters of a Function in Javascript

  • Calling of a Function in Javascript

  • Return Statement in Javascript

Suggestions: Before reading this article about functions in javascript, you have to know about Conditional Statements JavaScript(IF ELSE SWITCH). below is some example of predefined javascript functions

Defining a Function in Javascript:

The most common way to define a function in JavaScript is to use function keyword before function name, parameter list can be empty or can contain a list of parameters and block of code of the function is written inside the curly braces.

Syntax of a Function in Javascript:

Calling means to invoke or using a function somewhere in the JavaScript code. A function is called simply by writing the name of that function if there are some parameters then pass those parameters.

Read: Stopwatch in Javascript.


Thanks for the awesome article, Your explanation is great in a simple language. I also gone through a links you shared You made a indepth article on Functions in Java Script.

Awesome post in a single article We got a multiple useful domains links I really appreciate that you have shared links in an article.


Boostlog is an online community for developers
who want to share ideas and grow each other.

Delete an article

Deleted articles are gone forever. Are you sure?