Pangram checker: Difference between revisions

Content added Content deleted
m (→‎JS Functional: Applied ESLint, tidied.)
Line 1,731: Line 1,731:


<lang JavaScript>(() => {
<lang JavaScript>(() => {
'use strict';
"use strict";

// ----------------- PANGRAM CHECKER -----------------


// isPangram :: String -> Bool
// isPangram :: String -> Bool
let isPangram = s => {
const isPangram = s =>
let lc = s.toLowerCase();
0 === "abcdefghijklmnopqrstuvwxyz"
.split("")
.filter(c => -1 === s.toLowerCase().indexOf(c))
.length;


// ---------------------- TEST -----------------------
return 'abcdefghijklmnopqrstuvwxyz'
.split('')
.filter(c => lc.indexOf(c) === -1)
.length === 0;
};

// TEST
return [
return [
'is this a pangram',
"is this a pangram",
'The quick brown fox jumps over the lazy dog'
"The quick brown fox jumps over the lazy dog"
].map(isPangram);
].map(isPangram);

})();</lang>
})();</lang>