2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
|
|
@ -1,12 +1,11 @@
|
|||
function is_pangram(str) {
|
||||
var s = str.toLowerCase();
|
||||
function isPangram(s) {
|
||||
var letters = "zqxjkvbpygfwmucldrhsnioate"
|
||||
// sorted by frequency ascending (http://en.wikipedia.org/wiki/Letter_frequency)
|
||||
var letters = "zqxjkvbpygfwmucldrhsnioate";
|
||||
s = s.toLowerCase().replace(/[^a-z]/g,'')
|
||||
for (var i = 0; i < 26; i++)
|
||||
if (s.indexOf(letters.charAt(i)) == -1)
|
||||
return false;
|
||||
return true;
|
||||
if (s.indexOf(letters[i]) < 0) return false
|
||||
return true
|
||||
}
|
||||
|
||||
print(is_pangram("is this a pangram")); // false
|
||||
print(is_pangram("The quick brown fox jumps over the lazy dog")); // true
|
||||
console.log(isPangram("is this a pangram")) // false
|
||||
console.log(isPangram("The quick brown fox jumps over the lazy dog")) // true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue