Can you help me with this error: "Cannot read the property 'nota' of undefined. "
const arrayN = [
{nome: "Rapha", nota: 10},
{nome: "Renan", nota: 8},
{nome: "Stefani", nota: 12}
];
function maiorNota(alunos) {
// Encontrando a maior nota no vetor turma.
let maior = [];
for (let i = 0; i < alunos.length; i++) {
if (alunos[i].nota > alunos[i+1].nota || alunos[i].nota > maior) {
maior = alunos[i];
}
} return maior;
}
const melhor = maiorNota(arrayN)
console.log(melhor)