+ 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.
2 Antworten
+ 17
b=0
array.map(function(a){return Math.sqrt(a)}).forEach(function(a){b+=a})
b/=array.length
+ 4
Thanks...