Skip to content

Instantly share code, notes, and snippets.

@jonathanwork
Created April 21, 2016 21:57
Show Gist options
  • Save jonathanwork/e0242da811923f50388dba4c6cdb344a to your computer and use it in GitHub Desktop.
Save jonathanwork/e0242da811923f50388dba4c6cdb344a to your computer and use it in GitHub Desktop.
this gives results to pangrams
//creator Jonathan R. Lopez
var write = function(inputString) {
process.stdout.write(inputString);
}
var test = function() {
return 'has test'
}
var checkingAlphabet = function(result) {
//var checkResult = !result ? null : result;
hasAlphabet = /^[a-z]$/i;
if(result.search(hasAlphabet)) {
return "pangram";
} else {
return "not pangram";
}
}
//this function loop throgh every char
var loopingThroughChar = function(a, fn) {
var result = '';
for(var i = 0; i <= a.length; i++) {
var removeWhiteSpace = /\s/;
result += a.charAt(i).replace(removeWhiteSpace, '');
}
//returns a result.
var output = fn ? fn(result) : result;
write(output);
}
loopingThroughChar(input,checkingAlphabet);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment