So I'm looking to write a function for my class that is titled isAlpha
that accepts a character (preferably a string with length of 1) and returns true if it's a letter and false if it's not.
The thing is I'm completely stuck on where to go. This is the example the instructor gave in class:
var isAlpha = function(ch){
//if ch is greater than or equal to "a" AND
// ch is less than or equal to "z" then it is alphabetic
}
var ltr ="a", digit =7;
alert(isAlpha(ltr));
alert(isAlpha(digit))
I'm not sure what to do with that though, I've tried a few different things like:
var isAlpha = function(ch){
if (ch >= "A" && ch <= "z"){
return true
}
}
alert(isAlpha(ch))
Can anyone point me in the right direction of how to this function started?