JavaScript Functions

Anik Haque
Aug 27, 2023

--

Code Reusability: Functions are defined only once and can be invoked many times, like in other programming languages.

Less Code: It saves a lot of code because you don ‘t need to write the logic many times. By the use of function, you can write the logic only once and reuse it.

Easy to understand: Functions separate the programming logic. So it is easier to understand the flow of the application because every logic is divided in the form of functions.

JavaScript functions are used to perform operations. We can call JavaScript function many times to reuse the code.

FUNCTION ARGUMENTS

We can call function by passing arguments. Let’s see the example of function that has one argument.

FUNCTION RETURN

We can call function that returns a value and use it in our program.

--

--