Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Printer Errors

/*
In a factory a printer prints labels for boxes. For one kind of boxes 
the printer has to use colors which, for the sake of simplicity, 
are named with letters from a to m.
*/

const printerError = s => {
  let ratio = 0
  s.split("")
    .forEach(letter => (letter.charCodeAt(0) & 31) > 13 ? ratio+=1: null)
  return `${ratio}/${s.length}`
}

// With love @kouqhar
Source by www.codewars.com #
 
PREVIOUS NEXT
Tagged: #Printer #Errors
ADD COMMENT
Topic
Name
4+3 =