Guest User

Untitled

a guest
May 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. function isIsogram(str = null){
  2. if((str == null) || (typeof str !== 'string') || (str.length <= 0)) {
  3. return false;
  4. } else {
  5. // Convert word to array and split word
  6. let words = str.split('')
  7. // Return true if word is an isogram
  8. return words.length === words.filter(
  9. (string, index, arr) => arr.indexOf(string) == index
  10. ).length
  11. }
  12. }
Add Comment
Please, Sign In to add comment