Calling function in another function
function add(a, b) {
return a + b;
}
var x = add(1, 2);
function total() {
return x;
}
console.log(total()); // 3
/*
OR
*/
function complete() {
return add(1, 2);
}
console.log(complete()); // 3
function greeting() {
console.log("Hi");
}
greeting(); // Hi
function greetingOne() {
greeting();
}
greetingOne(); // Hi