Function Definitionīefore we use a function, we need to define it. This section explains how to write your own functions in JavaScript. JavaScript allows us to write our own functions as well. We were using these functions again and again, but they had been written in core JavaScript only once. You must have seen functions like alert() and write() in the earlier chapters. Like any other advanced programming language, JavaScript also supports all the features necessary to write modular code using functions. Functions allow a programmer to divide a big program into a number of small and manageable functions. It helps programmers in writing modular codes. This eliminates the need of writing the same code again and again. A function is a group of reusable code which can be called anywhere in your program.
0 Comments
Leave a Reply. |