Answers for "ways to loop through an array algorithm"

1

java loop through array

class LoopThroughArray {
	public static void main(String[] args)
	{

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

		for(int i : myArr){

			System.out.println(i + "\n")

		}

		/* Output:
		1
		2
		3
		4
		*/

	}
}
Posted by: Guest on August-31-2020
0

how to iterate in array of array

var printArray = function(arr) {
    if ( typeof(arr) == "object") {
        for (var i = 0; i < arr.length; i++) {
            printArray(arr[i]);
        }
    }
    else document.write(arr);
}

printArray(parentArray);
Posted by: Guest on September-17-2020

Code answers related to "ways to loop through an array algorithm"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language