forEach Method

by Ken Sprague

JavaScript

let heroes = ['Batman', 'Robin', 'Batgirl', 'Wonder Woman', 'Superman', 'Flash', 'Aquaman', 'Swamp Thing'];

//convert all the names to lowercase except Flash
//and console.log them

heroes.forEach(function(item, index, array){
		console.log(index, item);
});

heroes.forEach(function(item, index, array){
		if(item === 'Flash'){
    	item = item.toUpperCase();
    }else{
    	item = item.toLowerCase();
    }
    console.log(index, item);
});