Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
"Striped Words" solution in Clear category for [old] Striped Words by capback250
'use strict';
const vowels = 'AEIOUY';
const consonants = 'BCDFGHJKLMNPQRSTVWXZ';
function stripedWords(text) {
return text
.replace(/\.|,|\?/g, ' ')
.split(' ')
.filter(e=> e.length > 1 && !/\d/.test(e))
.map(e=> e.toUpperCase())
.map(e => {
for(let i = 0; i < e.length - 1; i++) {
let a = e[i], b = e[i + 1];
if ((vowels.includes(a) && vowels.includes(b)) || (consonants.includes(a) && consonants.includes(b))) return 0
}
return 1
}).reduce((a, b) => a + b, 0)
}
May 17, 2017