Wednesday, May 5, 2021

Javascript Practice 31: JS Hero - Parentheses

 
Question: 

Write a function mean that takes 2 numbers and returns their mean value.

Example: mean(1, 2) should return 1.5.




Answer: 

function mean (n1, n2) {

return (n1+n2) / 2; 

}; 

> basic mathematical operation to be used 

No comments:

Post a Comment