Posts

Showing posts with the label JavaScript: Function Types Javascript

JavaScript: Function Types

Image
L et's start it and see some basic types! ◉   Named Function (Traditional way):   The traditional way of creating a function and it's a set of statements that performs a task or calculates a value!  function sayHello() {   console.log('Hey everyone!'); } sayHello(); // Output 'Hey everyone!' ◉   Arrow Function:  Arrow Functions  are simpler, are always unnamed and compact than traditional function expression! const sayHello = () => console.log('Hey everyone!'); sayHello(); // Output 'Hey everyone!' ◉   Anonymous Function: Anonymous Functions  don't have a name specified after the  function  declaration, so we declare it with a variΓ‘vel to call this function at a some point and the function is anonymous but assigned to a variable! const sayHello = function () {   console.log('Hey everyone!'); } sayHello(); // Output 'Hey everyone!'  ◉  Higher Order Function: Higher Order Functions  in a nutshell words is a function that can