Understanding JavaScript Functions

What is function in JavaScript? A function is a type of program, or part of the program, that can be called from the main JavaScript program to perform certain tasks. We can also define a function as a module of the main JavaScript program. A professionally written JavaScript program usually consists of numerous functions. It is easier to construct , debug and maintain a large program that make up of smaller modules, because the programmer needs only debug a module or modules if certain errors occur, instead of having to search for the whole program and trying to locate the error code.

There are two kinds of functions in JavaScript , the built-in functions and the user-define functions. Built-in functions are also known as methods that are tied to certain objects. For example, functions that are tied to the Math object are round, pow and more. There are also string manipulation functions, date and time functions and many more,  please refer to our previous lessons for more information on these functions.

Read On……