Javascript offers many different ways to loop, click here for more information
let fruits=[“Banana”,”Apple”,”Pear”];
fruits.forEach(function(element,index){
console.log(element,index);
});
click here for more information about the forEach() loop
let fruits=[“Banana”,”Apple”,”Pear”];
$.each(fruits, function(index, element){
console.log(index, element);
});
click here for more information about the jQuery’s $.each() loop