I was given this string:
var myMessage = "Learning is fun!"
This is how I attempted to create an array listing only the letters (without the spaces and "!").
var myMessage = "Learning is fun!";
var arr1 = myMessage.split("");
function onlyLetters(array){
let arr2 = []
for(let i = 0; i < array.length; i++){
if(array[i] === "a" || "b" || "c" || "d" || "e"
|| "f" || "g" || "h" || "i" || "j" || "k" || "l"
|| "m" || "n" || "o" || "p" || "q" || "r" || "s"
|| "t" || "u" || "v" || "w" || "x" || "y" || "z"){
arr2.push(array[i])
}
}
return arr2
}
console.log(onlyLetters(myMessage))
What am I doing wrong? Also, is there a shorthand for listing letters "a" through "z"?