Sunday, August 22, 2021

Functions Calling Other Functions in Javascript

Functions Calling Other Functions : In Javascript like other programming language we can also call one function inside another function.

// Calling one function inside another one..

const fruitCutter = function (fruits) {
return fruits * 3;
}

const fruitProcessor = function (apples, oranges) {
const applePieces = fruitCutter(apples);
const orangePices = fruitCutter(oranges);
const juice = `Juice with ${applePieces} apple pieces and ${orangePices} orange pieces`;
return juice;
}

console.log(fruitProcessor(2, 2));

0 comments

Post a Comment