DEV Community

Discussion on: Daily Challenge #272 - Printer Errors

Collapse
 
jjjimenez100 profile image
Joshua Jimenez

JS - Functional, no regex.

const error_printer = word => {
    const invalidCharacters = [...word]
          .map(word => word.charCodeAt(0))
          .filter(
              charCode => charCode < 97 || charCode > 109
           );
    return `${invalidCharacters.length}/${word.length}`;
};