Hi makenzi.exc,
The RMS (Root mean square) value of a distribution is the square root of the mean of the squares of the elements.
To calculate the RMS value follow the below steps.
1. Square all the elements in the Array.
2. Calculate the Sum of Squares Array.
3. Divide it by the number of the elements and finally, take the Square root of that number using Math class.
Refer below example.
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style type="text/css">
body { font-family: Arial; font-size: 10pt; }
</style>
</head>
<body>
<script type="text/javascript">
window.onload = function () {
// Define the Array.
var arr = [5, 4, 10, -9, -7];
// Calculate the Squares of each item in the Array.
var squares = arr.map((val) => (val * val));
// Calculate the Sum of Squares Array.
var sum = 0;
squares.forEach(number => {
sum += number;
});
// Calculate Root mean square.
alert(Math.sqrt(sum / arr.length));
};
</script>
</body>
</html>
Demo
Screenshot

Downloads
Download Sample