Build a Recipe Tracker - Step 7 JavaScript

Hello I cant seem to figure out the issue with my code. It returns the correct result but it still doesn’t pass the test….

function getAverageRating (obj) {

let sum = obj.ratings\[0\] + obj.ratings\[1\] + obj.ratings\[2\] + obj.ratings\[3\];

let avg = sum/obj.ratings.length

return avg

}

console.log(getAverageRating(recipe1))

console.log(getAverageRating(recipe2))

console.log(getAverageRating(recipe3))

Please post a link to the Step and talk about how you got stuck debugging. Thanks

I’m not exactly sure what you mean as i’m new here… i mean the function returns the correct numbers, i don’t know what else to say or add… i’m just wondering if someone here can point out the issue with my function…

Nevermind I figured it out