-
-
Save RHeijnen/2e56fb3362eedef3149e0c8fcde053bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var obj = require('./json.json'); | |
var counter = 0; | |
var result = []; | |
for(var x = 0; x < obj.Data.length;x++){ | |
var valueContainer = []; | |
for(var i = 0; i < obj.Data.length;i++){ | |
try{ | |
var itt = obj.Data[i].Data; | |
if(itt[counter].Value){ | |
valueContainer.push(itt[counter].Value) | |
} | |
}catch(e){ | |
} | |
}; | |
var sum = 0; | |
for(var i = 0; i < valueContainer.length;i++){ | |
sum = sum + valueContainer[i]; | |
} | |
sum = sum / valueContainer.length; | |
result.push(sum) | |
counter = counter +1; | |
} | |
var workaroundContainer = []; | |
for(var i = 0; i < result.length;i++){ | |
if(result[i]){ | |
workaroundContainer.push(result[i]) | |
} | |
} | |
console.log(workaroundContainer) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this is a piece of code a student showed me, LOL