Test case details

Preparation Code

const color=['black',"brown","red","orange","yellow","green","blue","violet","grey","white"] const colorMap={'black':0,"brown":1,"red":2,"orange":3,"yellow":4,"green":5,"blue":6,"violet":7,"grey":8,"white":9} const decodedValue1 = (code1) => Number(String(color.indexOf(code1[0]))+String(color.indexOf(code1[1]))) const decodedValue2 = (code1) => color.indexOf(code1[0])*10 +color.indexOf(code1[1]) const decodedValue3 = (code1) => color[code1[0]]*10 +color[code1[1]]

Test cases

Test #1

decodedValue1(['white', 'green'])

Test #2

decodedValue2(['white', 'green'])

Test #3

decodedValue3(['white', 'green'])