Javascript to generate random case letters
- 2020-03-30 02:04:50
- OfStack
function getLowerCharacter(){
return getCharacter("lower");;
}
function getUpperCharacter(){
return getCharacter("upper");;
}
function getCharacter(flag){
var character = "";
if(flag === "lower"){
character = String.fromCharCode(Math.floor( Math.random() * 26) + "a".charCodeAt(0));
}
if(flag === "upper"){
character = String.fromCharCode(Math.floor( Math.random() * 26) + "A".charCodeAt(0));
}
return character;
}