Skip to content

Instantly share code, notes, and snippets.

@Samuelachema
Created August 14, 2018 00:01
Show Gist options
  • Save Samuelachema/0ec85b980807f5a7932bf1bcb9753f06 to your computer and use it in GitHub Desktop.
Save Samuelachema/0ec85b980807f5a7932bf1bcb9753f06 to your computer and use it in GitHub Desktop.
Create a method isIsogram that takes one argument, a word to test if it's an isogram. This method should return a boolean indicating whether it is an isogram. If the argument supplied is an empty string, return False.
function isIsogram(word){
if (word !== undefined){
const wordArr = word;
if(word === ""){
return false;
}
for (let i = 0; i < wordArr.length; i++) {
for (let j = 0; j < wordArr.length; j++) {
if(i!=j){
if (wordArr[i] == wordArr[j]) {
return false
}
}
}
}
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment