DEV Community

Discussion on: Daily Challenge #272 - Printer Errors

Collapse
 
_bkeren profile image
''

JS


const error_printer = word => {
    const regex = /[a-m]/g
    const proper_num_of_matches = ((word || '').match(regex) || []).length
    return `${word.length - proper_num_of_matches}/${word.length}`
}