afoysal
1 year ago

Condition based iteration using for loop in JavaScript

Posted 1 year ago by afoysal

I am trying to play audio file using for loop in vue.js. My code is like below

    for(var i = this.start; i < this.end; i++) {
        var audio = new Audio('some value');
        audio.play();
        if(audio.ended == true) {
            //go for another iteration
        }
    }

I would like to go for another iteration after the condition is true. Actually I would like to play audio file one after another. How can I do that ?

Please sign in or create an account to participate in this conversation.