Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

circular object array

<script>
// javascript program to demonstrate use of circular
// array using extra memory space
 
    // function to print circular list
    // starting from given index ind.
    function print(a, n, ind)
    {
 
        // print from ind-th index to
        // (n+i)th index.
        for (var i = ind; i < n + ind; i++)
            document.write(a[parseInt(i % n)] + " ");
    }
 
    // Driver code
        var a =[ 'A', 'B', 'C', 'D', 'E', 'F' ];
        var n = 6;
        print(a, n, 3);
 
// This code is contributed by Rajput-Ji
</script>
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #circular #object #array
ADD COMMENT
Topic
Name
5+2 =