Need Help in javascript

Report
Question

Please briefly explain why you feel this question should be reported .

Report
Cancel

I made a image gallery that shows images randomly

Now I was only able to create a button for next but I need a button also for the previous image

a file has been attached with the html file and images

 

 


Attachment

Attachment
in progress 0
JavaScript 3 weeks 1 Answer 784 views 0

About rafi1997

Answer ( 1 )

  1. ritwik

    Please briefly explain why you feel this answer should be reported .

    Report
    Cancel

    The solution lies in looping through an array in forward and reverse order. Following example may be useful for you –

    var myStringArray = ["w3","resource"];
    var arrayLength = myStringArray.length;
    for (var i = 0; i < arrayLength; i++) {
        console.log(myStringArray[i]);
    }
    
    var myStringArray = ["w3","resource"];
    var arrayLength = myStringArray.length;
    for (var i = arrayLength - 1; i >= 0; i--) {
        console.log(myStringArray[i]);
    }
    

Leave an answer

Browse

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>