Skip to main content

function in javascript

 here in this blog we are going to study about function in javascript


repel for functions(fb login)


so here is the code as follows

// function in javascript

function oneplusavg(x,y) {

  console.log("done")

  return Math.round(1+(x+y)/2)

}


// modern function writing way

// this is arrow function

const hello = ()=>{

  console.log("arey maza aa gaya bhai")

}


let a=1;

let b=2;

let c=3;

hello();

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))



Comments