Answers for "js check string for isogram"

0

js check string for isogram

// Check if a string is an isogram
function isIsogram(str){
   return !str.match(/([a-z]).*\1/i);
  //or: return new Set(str.toLowerCase()).size === str.length;
}
console.log(isIsogram("Dermatoglyphics"));//, true
console.log(isIsogram("isogram"));		  //, true
console.log(isIsogram("moOse"));		  //, false
console.log(isIsogram("isIsogram"));	  //, false
console.log(isIsogram(""));				  //, true
Posted by: Guest on April-01-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language