Answers for "looping thorugh array"


javascript code to loop through array

var colors = ["red","blue","green"];
for (var i = 0; i < colors.length; i++) {
Posted by: Guest on July-22-2019

iterate through list javascript

const array = ["hello", "world"];

for (item of array) {
Posted by: Guest on May-24-2020

how to loop through an array

int[] numbers = {1,2,3,4,5};
for (int i = 0; i < numbers.length; i++) {
Posted by: Guest on April-21-2020

how to loop through an array

var array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
//loop thrugh all of the numbers of the array and print them
for(let i = 0; i < array.length; i++){
	console.log(array[i]); //print all the array data in the length of i

//we can create some variable that store the array data and than display it 
//using for...of

for(let data of array){
	console.log(data); //print all the data that was stored in the "data" variable
Posted by: Guest on May-24-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language