JavaScript Functions
JS
A function is a block of code designed to perform a particular task. Functions allow you to organize your code, make it reusable, and improve readability.
Advantage of JavaScript function
Code reusability: We can call a function several times so it save coding.
Less coding: It makes our program compact. We don't need to write many lines of code each time to perform a common task.
Declare a function
Call the function
Example
Examples