JSFiddle - React, Tailwind, and code Playground

by Cioc Andrei

HTML

<div id="wrapper"></div>

CSS

table, th, td {
    border: 1px solid black;
}

JavaScript

var lista = {
    "1": {
        nume: "Popescu",
        prenume: "Ion",
        notaRomana: 5,
        notaMate: 7
    },
        "2": {
        nume: "Iliescu",
        prenume: "Andrei",
        notaRomana: 6,
        notaMate: 9
    },
        "3": {
        nume: "Constantinescu",
        prenume: "Oana",
        notaRomana: 9,
        notaMate: 6
    },
        "4": {
        nume: "Visan",
        prenume: "Cristina",
        notaRomana: 7.4,
        notaMate: 8
    }
};

var wrapper = $('#wrapper');


wrapper.append('<table>');
wrapper.append('<tr>');
wrapper.append('<th>Nr Crt </th> ');
wrapper.append('<th>Nume </th> ');
wrapper.append('<th>Prenume </th> ');
wrapper.append('<th>Nota Romana </th> ');
wrapper.append('<th>Nota Matematica </th> ');
wrapper.append('<th>Media </th> ');
wrapper.append('</tr>');
wrapper.append('</table>');
for (var id in lista) {
    wrapper.append('<tr>');
    wrapper.append('<th>' + id + '</th>');
    wrapper.append('<th>' + lista[id].nume + '</th>');
    wrapper.append('<th>' + lista[id].prenume + '</th>');
    wrapper.append('<th>' + lista[id].notaRomana + '</th>');
    wrapper.append('<th>' + lista[id].notaMate + '</th>');
    wrapper.append('<th>' + (lista[id].notaRomana + lista[id].notaMate) / 2 + '</th>');
    wrapper.append('</tr>');
}
wrapper.append('Media generala este:');
for (var id in lista) {
    var mediaGenerala = 0;
    for (var i = 1; i <= id; i++) {
        mediaGenerala += (lista[i].notaRomana + lista[i].notaMate) / 2;

    }

}
wrapper.append(mediaGenerala / id);