CodeWars is a site for programming practice.
Users post challenges for others to solve, and your solution is displayed alongside others.
Your code is tested using TDD frameworks.
Below are a few select solutions I have completed.
const passTheDoorMan = word => {
const alphabet = "abcdefghijklmnopqrstuvwxyz";
for (let i = 0; i < word.length - 1; i++) {
if (word[i] == word[i + 1]) {
return (alphabet.indexOf(word[i]) + 1) * 3;
}
}
return 0;
};
const printerError = s => {
let invalidCharCount = s.split("").reduce((acc, nxt) => acc + (nxt > "m" ? 1 : 0), 0);
return `${invalidCharCount}/${s.length}`;
};