JavaScript
Functions
A
function is a block of JavaScript code that is defined once but may be executed
or invoked any number of times. Functions are used to encapsulate code that
performs a specific task. Sometimes functions are defined for commonly required
tasks to avoid the repetition entailed in typing the same statements over and
over. More generally, they are used to keep code that performs a particular job
in one place in order to enhance reusability and program clarity.
JavaScript
functions are parameterized or non-parameterized. A parameterized function
definition may include a list of identifiers, known as parameters that work as
local variables for the body of the function. Function invocations provide
values or arguments for the function’s parameters. Functions often use their
argument values to compute a return value that becomes the value of the
function invocation expression.
JavaScript
supports two types functions. They are
•
Pre-defined
or Library Functions
•
User-defined
Functions
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.