function matchTable(matchArray){
    var col = ['Name','Start Time', 'Winner'];
    var table = document.createElement("table");
    var tr = table.insertRow(0);

    for (var i = 0; i < col.length; i++) {
        var th = document.createElement("th");
        th.innerHTML = col[i];
        tr.appendChild(th);
    }

    for (var i = 0; i < matchArray.length; i++) {
        tr = table.insertRow(-1);
        var insertString ="";
        for (var j = 0; j < col.length; j++) {
            var tabCell = tr.insertCell(-1);
            switch(j){
                case 0:
                    insertString = cleanString(matchArray[i].name)
                    tabCell.innerHTML = insertString
                    break;
                case 1: 
                    insertString = cleanString(matchArray[i].begin_at)
                    tabCell.innerHTML = insertString
                    break;
                case 2: 
                    insertString = cleanString(matchArray[i].winner_id)
                    tabCell.innerHTML = insertString
                    break;
            }
            
        }

    }
        var divShowData = document.getElementById('matchesInfo');
        divShowData.innerHTML = "";
        divShowData.appendChild(table);
}
//it allows for dynamic tables to be made based on the provided array
it allows for dynamic tables to be made based on the provided array
it allows for dynamic tables to be made based on the provided array
function matchTable(matchArray){
    var col = ['Name','Start Time', 'Winner'];
    var table = document.createElement("table");
    var tr = table.insertRow(0);
    for (var i = 0; i < col.length; i++) {
        var th = document.createElement("th");
        th.innerHTML = col[i];
        tr.appendChild(th);
    }
    for (var i = 0; i < matchArray.length; i++) {
        tr = table.insertRow(-1);
        var insertString ="";
        for (var j = 0; j < col.length; j++) {
            var tabCell = tr.insertCell(-1);
            switch(j){
                case 0:
                    insertString = cleanString(matchArray[i].name)
                    tabCell.innerHTML = insertString
                    break;
                case 1: 
                    insertString = cleanString(matchArray[i].begin_at)
                    tabCell.innerHTML = insertString
                    break;
                case 2: 
                    insertString = cleanString(matchArray[i].winner_id)
                    tabCell.innerHTML = insertString
                    break;
            }
        }
    }
        var divShowData = document.getElementById('matchesInfo');
        divShowData.innerHTML = "";
        divShowData.appendChild(table);
}
function matchTable ( matchArray ) { var col = [ 'Name' , 'Start Time' , 'Winner' ] ; var table = document . createElement ( "table" ) ; var tr = table . insertRow ( 0 ) ; for ( var i = 0 ; i < col . length ; i ++ ) { var th = document . createElement ( "th" ) ; th . innerHTML = col [ i ] ; tr . appendChild ( th ) ; } for ( var i = 0 ; i < matchArray . length ; i ++ ) { tr = table . insertRow ( - 1 ) ; var insertString = "" ; for ( var j = 0 ; j < col . length ; j ++ ) { var tabCell = tr . insertCell ( - 1 ) ; switch ( j ) { case 0 : insertString = cleanString ( matchArray [ i ] . name ) tabCell . innerHTML = insertString break ; case 1 : insertString = cleanString ( matchArray [ i ] . begin_at ) tabCell . innerHTML = insertString break ; case 2 : insertString = cleanString ( matchArray [ i ] . winner_id ) tabCell . innerHTML = insertString break ; } } } var divShowData = document . getElementById ( 'matchesInfo' ) ; divShowData . innerHTML = "" ; divShowData . appendChild ( table ) ; }
it allows for dynamic tables to be made based on the provided array
it allows for dynamic tables to be made based on the provided array