1. Home
  2. Docs
  3. Web Technology I
  4. JavaScript-Client Side Sc...
  5. Functions

Functions

Here is detailed explanation of Functions:

  • Function Declaration
function functionName(parameters) {
  // Code to be executed
}
  • Function Expression
const functionName = function(parameters) {
  // Code to be executed
};
  • Arrow Function (ES6+)
const functionName = (parameters) => {
  // Code to be executed
};
  • Parameters: Variables listed in the function definition.
function add(x, y) {
  // x and y are parameters
  return x + y;
}
  • Arguments: Values passed to a function when it is called.
const result = add(5, 3); // 5 and 3 are arguments

How can we help?

Leave a Reply

Your email address will not be published. Required fields are marked *