πFunctions
function sayHello(username) {
console.log(`Hello ${username}`);
}
sayHello("HuXn"); // Function Expressions
const greetings = function (user) {
console.log(`Hello ${user}`);
};
greetings("Doe");JavaScript Arrow Function
// ----- Normal Function -----
let x = function(x, y) {
return x * y;
}can be also used as
// ----- Arrow Function -----
let x = (x, y) => x * y;Last updated