Javascript Function expressions

In JavaScript, a function expression is a way to define a function using an expression, instead of the function declaration statement.

Syntax:

const functionName = function(parameter1, parameter2, ...) {
   // function body
   return value; // optional
}

Example:

const multiply = function(x, y) {
   return x * y;
};

console.log(multiply(3, 4)); // output: 12

Output:

12

In this example, we’re defining a function expression named multiply that takes two parameters x and y. The function multiplies the two parameters and returns the result.

We then call the multiply function and pass in the values 3 and 4 as arguments. The function returns the result, which is 12, and we log it to the console using console.log().