3 Simple ways to declare function in JavaScript

3 Simple ways to declare function in JavaScript

functions in JavaScript

Way-1

function printMe() {

console.log("printing me");

}

INPUT - printMe;

OUTPUT - printing me

Way-2

function printThis(para){ //parameter

console.log("para");

}

INPUT - printThis("This is a parameter"); // value passed (calling function),argument

OUTPUT - This is a parameter

EXPLANATION - [This is a parameter] mapped with [para]

Way-3

const printMeAgain=function(){

console.log("print this"); //value passed

}

INPUT -printMeAgain()

OUTPUT - print this

Conclusion-

Understanding how functions in JavaScript are been used.