repl.it
@olafem/

Isogram

JavaScript

No description

fork
loading
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//An isogram is a word that has no repeating letters, consecutive or non-consecutive. Implement a function that determines whether a string that contains only letters is an isogram. Assume the empty string is an isogram. Ignore letter case.

function isIsogram(str){
  var strK = str.toLowerCase();
    for(var i = 0;i<strK.length;i++){
      for(var j = i+1;j<strK.length;j++){
      if(strK[i]===strK[j]) return false;
      }
    }
  return true;
}

console.log(isIsogram('aksjaiwflajsdioaw'));
console.log(isIsogram('jawabarat'));
console.log(isIsogram('asdfghjkloi'));
console.log(isIsogram('koapsjioawjd'));
console.log(isIsogram('aksjaiwflajsdioaw'));
Native Browser JavaScript