How can I fix this problem. Actually this is an exercise about how to use debugger but I couldn't solve the problem.
Fix the cutestCat function. Should return the cat with the highest cuteness
rating.
*/
function cutestCat(cats) {
let cutest;
let i = 0;
debugger
while (i < cats.length) {
const cat = cats[i];
if (cat > cutest) {
cutest = cat.cuteness;
}
i++;
}
return cutest;
}
const cats = [
{ name: 'Fluffy', cuteness: 9 },
{ name: 'Princess', cuteness: 6 },
{ name: 'Tiger', cuteness: 7 },
{ name: 'Indie', cuteness: 5 },
]
console.log(cutestCat(cats)); // { name: 'Fluffy', cuteness: 9 }