Skip to content

Commit

Permalink
changed for loop to es6 standard
Browse files Browse the repository at this point in the history
  • Loading branch information
pavanvamsi3 committed Oct 6, 2017
1 parent 19f52e2 commit cfeb2ed
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ let variance = numbers => {
return null;
}
let initialMean = mean(numbers);
let varianceNumbersArray = [], i;
for(i = 0; i < numbers.length; i += 1) {
let varianceNumber = numbers[i] - initialMean;
let varianceNumbersArray = [];

for (let value of numbers) {
let varianceNumber = value - initialMean;
varianceNumbersArray.push(varianceNumber * varianceNumber);
}
let variance = mean(varianceNumbersArray);
Expand Down

0 comments on commit cfeb2ed

Please sign in to comment.