Untitled

 avatar
unknown
plain_text
4 years ago
442 B
10
Indexable
var time = [];

var counter = 1;

var eightSeconds = setTimeout(function() {
    console.log(time)
}, 8 * 1000);

var add = setInterval(function(){
    time.push(counter);
    console.log(counter)
    if(time.length > 15){
        clearInterval(add);
        console.log(sum());
    }
    counter++;
}, 1000);



function sum(){
    var total = 0

    time.forEach(function(element){
    total += element
    });
}
Editor is loading...