function allCokPerHour() {

    // var container = document.getElementById('location1');

    // var tableEl = document.createElement('table');
    // container.appendChild(tableEl);

    var row = document.createElement('tr');//new row
    tableEl.appendChild(row);

    var head = document.createElement('th');
    row.appendChild(head);

    head.textContent = 'Total';

    // this loops calculat table valus vertically.
    // the first loop hold on spisific"obenHour" until the next loop get all that "obenHour" valus for all rows.

    var perHour = [];//to creat array contains all total amount per hour
    var all = 0;       //to save the total of total
    for (var hour = 0; hour < obenHour.length; hour++) {
        var totalSum = 0;
        for (var index = 0; index < locations.length; index++) {  //make the globle "locations"array as counter wich is contains the locations objects 
            totalSum += locations[index].purchasedPerHour[hour];  //add "totalSum" to previous, asb for sure valus and start from 0
        }

        all += totalSum;
        perHour.push(totalSum);//save in array

        var cell = document.createElement('td');
        row.appendChild(cell);
        cell.textContent = perHour[hour];
    }
    var cell = document.createElement('td');
    row.appendChild(cell);
    cell.textContent = all;

    perHour.push(all);

    
    return [totalSum, perHour];
}
//the folowing function calculat the Total amount of cookies for all location per hour(vertically through the table)
the folowing function calculat the Total amount of cookies for all location per hour(vertically through the table)
the folowing function calculat the Total amount of cookies for all location per hour ( vertically through the table )
function allCokPerHour() {
    var row = document.createElement('tr');
    tableEl.appendChild(row);
    var head = document.createElement('th');
    row.appendChild(head);
    head.textContent = 'Total';
    var perHour = [];
    var all = 0;       
    for (var hour = 0; hour < obenHour.length; hour++) {
        var totalSum = 0;
        for (var index = 0; index < locations.length; index++) {  
            totalSum += locations[index].purchasedPerHour[hour];  
        }
        all += totalSum;
        perHour.push(totalSum);
        var cell = document.createElement('td');
        row.appendChild(cell);
        cell.textContent = perHour[hour];
    }
    var cell = document.createElement('td');
    row.appendChild(cell);
    cell.textContent = all;
    perHour.push(all);
    return [totalSum, perHour];
}
function allCokPerHour ( ) { var row = document . createElement ( 'tr' ) ; tableEl . appendChild ( row ) ; var head = document . createElement ( 'th' ) ; row . appendChild ( head ) ; head . textContent = 'Total' ; var perHour = [ ] ; var all = 0 ; for ( var hour = 0 ; hour < obenHour . length ; hour ++ ) { var totalSum = 0 ; for ( var index = 0 ; index < locations . length ; index ++ ) { totalSum += locations [ index ] . purchasedPerHour [ hour ] ; } all += totalSum ; perHour . push ( totalSum ) ; var cell = document . createElement ( 'td' ) ; row . appendChild ( cell ) ; cell . textContent = perHour [ hour ] ; } var cell = document . createElement ( 'td' ) ; row . appendChild ( cell ) ; cell . textContent = all ; perHour . push ( all ) ; return [ totalSum , perHour ] ; }
the folowing function calculat the Total amount of cookies for all location per hour(vertically through the table)
the folowing function calculat the Total amount of cookies for all location per hour ( vertically through the table )
// var container = document.getElementById('location1'); // var tableEl = document.createElement('table'); // container.appendChild(tableEl); //new row // this loops calculat table valus vertically. // the first loop hold on spisific"obenHour" until the next loop get all that "obenHour" valus for all rows. //to creat array contains all total amount per hour //to save the total of total //make the globle "locations"array as counter wich is contains the locations objects  //add "totalSum" to previous, asb for sure valus and start from 0 //save in array