Skip to content

Instantly share code, notes, and snippets.

@colevandersWands
Created April 6, 2018 10:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colevandersWands/e82f31b746e37a4980da5dd3ca77a280 to your computer and use it in GitHub Desktop.
Save colevandersWands/e82f31b746e37a4980da5dd3ca77a280 to your computer and use it in GitHub Desktop.
function isIsogram(str){
let returner = true;
let table = {};
/* iterate through string
count every time we see a letter
the second time you see a letter, return false */
/* for letter in string
count every time we see a letter
the second time you see a letter, return false
END for*/
/*
for letter in string
see if letter is in "table"
the second time you see a letter, return false
END for */
/*
for letter in string
if (see if letter is in "table")
return false
else
add to "table"
END for */
for (let l in str) {
/* if (see if letter is in "table")
return false
else
add to "table"*/
if (str.l) {
return false;
} else {
str[l] = l;
};
};
return returner;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment