I'm trying to write a looping code that will remove all the names starting with the letter "a" but I'm not sure how to get it to work properly
let friends = ["Adam", "John", "Bernard", "Jacoub", "Arnold", "Kaytlen", "Samir"];
let letter = "a";
for (let i = 0; i < friends.length; i++){
if(friends[i][0] === "A"){
continue;
}
console.log(`${i} => ${friends[i]}`);
}
The problem is I want to write each index number before the name, but when I use continue;
it removes the whole thing and I get this output
//"1 => John"
//"2 => Bernard"
//"3 => Jacoub"
//"5 => Kaytlen"
//"6 => Samir"
Notice how index 0, 4 are missing