Functions in JavaScript

 function onePlusAvg(x, y) {

    return 1 + (x + y) / 2;
}

const sum = (p, q) => {
    return p + q;
}

const hello = () => {
    console.log("Hey How are you ? I am fine");
}

const Morning = () => {
    return "Hello, good morning";
}

let a = 1;
let b = 2;
let c = 3;

hello();
console.log(Morning());
console.log("One plus Average of a and b is : ", onePlusAvg(a, b));
console.log("One plus Average of b and c is : ", onePlusAvg(b, c));
console.log("One plus Average of a and c is : ", onePlusAvg(a, c));
console.log(sum(9, 7));

OUTPUT :
Hey How are you ? I am fine Hello, good morning One plus Average of a and b is : 2.5 One plus Average of b and c is : 3.5 One plus Average of a and c is : 3 16

Comments

Popular posts from this blog

Generators tutorial in Advance JavaScript

Document Object Module DOM querySelector and querySelectorAll tutorial in JavaScript

Find Even and Odd Numbers with Loops tutorial in JavaScript