Find words which contains more than 3 e vowels: Difference between revisions

Content added Content deleted
(Added a JavaScript version)
m (→‎{{header|JavaScript}}: Flipped order of a pair of names, for readability)
Line 1,251: Line 1,251:
// and none of its vowels are other than "e".
// and none of its vowels are other than "e".
const
const
[eCount, noOtherVowels] = [...w].reduce(
[noOtherVowels, eCount] = [...w].reduce(
([n, bool], c) => bool
([bool, n], c) => bool
? "e" === c
? "e" === c
? [1 + n, bool]
? [bool, 1 + n]
: "aiou".includes(c)
: "aiou".includes(c)
? [n, false]
? [false, n]
: [n, bool]
: [bool, n]
: [n, false],
: [false, n],


// Initial accumulator.
// Initial accumulator.
[0, true]
[true, 0]
);
);