-1
var alunos = document.querySelectorAll(".aluno");
for (var registro = 0; registro<alunos.length; registro++) {
var aluno= alunos[registro];
var nota1 = aluno.querySelector(".info-nota1").textContent;
var nota2 = aluno.querySelector(".info-nota2").textContent;
var tdMedia = aluno.querySelector(".info-media");
var media = (nota1+nota2)/2;
aluno.querySelector(".info-media").textContent=media;
}
To think about: using
parseInt
direct on sum, the variablesnota1
andnota2
evening strings for the rest of the program. It makes sense to have notes like string in that case?– Woss
Gee, I would never think of it ;-;. has how to do the direct sum without putting parseint?
– brenno amaral
I fixed the code, I had done it wrong on the fly. And @Andersoncarloswoss this is a great point to think about.
– Victor Eyer