Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to reverse an array

        int[] xr = {1, 2, 3, 4, 5};

        System.out.print("[");
        for (int i = xr.length - 1; i >= 0; i--) {
            System.out.print(xr[i] + ", ");
        }
        System.out.println("]");
    }
Source by stackabuse.com #
 
PREVIOUS NEXT
Tagged: #reverse #array
ADD COMMENT
Topic
Name
4+3 =