Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js check string for pangram

//Detect Pangram
function isPangram(string){
// character set capturing group with negative lookahead
  let regex = /([a-z])(?!.*1)/gi;
  return (string.match(regex)).length === 26;
}

console.log(isPangram("The quick brown fox jumps over the lazy dog."));// true
console.log(isPangram("This is not a pangram."));// false
console.log(isPangram("Pack my box with five dozen liquor jugs."));// true
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #check #string #pangram
ADD COMMENT
Topic
Name
6+5 =