Writing a function in Javascript
source link: https://dev.to/anjandutta/writing-a-function-in-javascript-35cf
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
What is a function
It is a way of writing a set of logic separately from the rest of the code. Functional coding is a clean, readable and reusable approach of programming.
It is also assigned a name for the ease of accessibility. Can we write functions without names? The answer is yes. We call those anonymous functions. I have discussed it later in this article.
Declaration of a function in Javascript
function name(parameter1, parameter2, ....) {
statement1
statement2
}
How to write a function in Javascript
A function declaration has three parts:
- Parameters
- Statements
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK