Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function isIsogram(str = null){
- if((str == null) || (typeof str !== 'string') || (str.length <= 0)) {
- return false;
- } else {
- // Convert word to array and split word
- let words = str.split('')
- // Return true if word is an isogram
- return words.length === words.filter(
- (string, index, arr) => arr.indexOf(string) == index
- ).length
- }
- }
Add Comment
Please, Sign In to add comment