What Is the function of JavaScript?
A function is a parametric block of code defined one time and called any number of times later. In JavaScript a function is composed and influenced by many components: A JavaScript function is a block of code designed to perform a particular task.
A JavaScript function is executed when "something" invokes it (calls it).
- JavaScript code that forms the function body
- The list of function parameters
- The variables accessible from the outer scope
- The returned value
- The context
this
when the function is invoked - Named or anonymous function
- The variable that holds the function object after declaration
- arguments object (or its missing in an arrow function)
These components affect the function behavior depending on the declaration type. In JavaScript a function can be declared using several ways:
JavaScript Functions declare to 6 Ways -
- Function declaration
- Function expression
- Shorthand method definition
- Arrow function
- Generator function
Function
constructor
0 comments:
Post a Comment