Here's my array:
const array = [
    {
        name: "kano",
        subject: "gujarati",
        marks: 99
    },
    {
        name: "kano",
        subject: "maths",
        marks: 99
    },
    {
        name: "kano",
        subject: "hindi",
        marks: 99
    },
    {
        name: "dixit",
        subject: "hindi",
        marks: 80
    },
    {
        name: "dixit",
        subject: "maths",
        marks: 80
    },
    {
        name: "dixit",
        subject: "gujarati",
        marks: 80
    },
]
How can I group it by name so that I would get the result of:
 {
    kano: {
        gujarati: 99,
        maths: 99,
        hindi: 99,
        total: 297,
        percentage: 99
    },
    dixit: {
        gujarati: 80,
        maths: 80,
        hindi: 80,
        total: 240,
        percentage: 80
    }
}
 
     
     
     
     
     
    