Hi there!. I’m new here and I got some issues to move on in my progress. I’m currently practicing my skills with Javascript Challenges and, although my code seems to work, I cannot make the “Test Code” to go through successfuly. It always returns "Tests failed to run due to an error: "Looks like your code is not compiling or not being exported with module.exports = statsFinder
. Check for a syntax error. “. Check your code and try again.”.
Thanks in advance. My code is the following:
function statsFinder(array) {
// Write your code here
let modeValue
let maxFilteredLength = 0;
let meanValue = array.reduce((accumulator, currentValue) =>{
return accumulator += currentValue
}) / array.length;
for (j = 0; j< array.length; j++) {
const filteredArray = array.filter((element) => {
return element === array[j]
});
if (filteredArray.length > maxFilteredLength) {
maxFilteredLength = filteredArray.length;
modeValue = filteredArray[0];
};
};
return [meanValue, modeValue]
};
console.log(statsFinder([500, 400, 400, 375, 300, 350, 325, 300]))
// Leave this so we can test your code:
module.exports = statsFinder;