Which approach can I use to solve this problem in Javascript? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Which approach can I use to solve this problem in Javascript?

I need to write a Javascript code that will calculate the square root of numbers in an array and generate the average of the square roots. Share your ideas if you can solve the problem with any other language.

14th Oct 2017, 12:16 PM
Aina Oluwafemi
Aina Oluwafemi - avatar
2 Answers
+ 17
b=0 array.map(function(a){return Math.sqrt(a)}).forEach(function(a){b+=a}) b/=array.length
14th Oct 2017, 12:22 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 4
Thanks...
15th Oct 2017, 2:36 AM
Aina Oluwafemi
Aina Oluwafemi - avatar