How do I use JS to compare array objects and draw results with Table?

problem description

give the original data:

var data = [
    {
        title: "",
        sex: "",
        age: "22",
        address: ""
    },
    {
        title: "",
        sex: "",
        age: "24",
        address: ""
    }
];

as above, how to compare two or more objects in an array and draw

with Table

the expected results are as follows:

< table > < thead > < tr > < th > title < / th > < th > Zhang San < / th > < th > Li Si < / th > < / tr > < / thead > < tbody > < tr > < td > sex < / td > < td > male < / td > < td > male < / td > < / tr > < tr > < td > age < / td > < td > 22 < / td > < td > 24 < / td > < / tr > < tr > < td > address < / td > < td > Jixiang Village < / td > < td > Yuhua Village < / td > < / tr > < / tbody > < / table >
Jan.29,2022

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style>

        </style>
    </head>
    <body>
        <table border="1">
            <tbody>
                
            </tbody>
        </table>
    </body>
    <script>
        var data = [
            {
                title: "",
                sex: "",
                age: "22",
                address: ""
            },
            {
                title: "",
                sex: "",
                age: "24",
                address: ""
            }
        ];
        var arr = [];
        for(var i in data[0]){
            arr.push([i])
        }
        for(var i in data){
            for(var j in data[i]){
                for(var k in arr){
                    if(arr[k][0]===j){
                        arr[k].push(data[i][j]);
                    }
                }
            }
        }
        var tbody = document.getElementsByTagName('tbody')[0];
        for(var i in arr){
            var tr = document.createElement("tr");
            for(var j in arr[i]){
                tr.innerHTML += '<td>'+arr[i][j]+'</td>';
            }
            tbody.appendChild(tr);
        }
        
    </script>
</html>
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e93058-68b94.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e93058-68b94.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?