Currently, I am working on creating a function for my class called isAlpha
which takes in a character (ideally a string with a length of 1) and outputs true if it is a letter or false if it is not. However, I am facing some challenges in figuring out the implementation. This is the example provided by my instructor:
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 have attempted different approaches such as:
var isAlpha = function(ch){
if (ch >= "A" && ch <= "z"){
return true
}
}
alert(isAlpha(ch))
If anyone could provide guidance on how to get started with this function, it would be greatly appreciated.