JSFiddle - React, Tailwind, and code Playground

by not important

CoffeeScript

colorSequence = [
    'red'
    'orange'
    'yellow'
    'green'
    'blue'
    'violet'
]

findWarnings = (activeColors) ->
    foundColors = []
    for color in colorSequence
        if activeColors[color]
            foundColors.push color
    [head, warningColors...] = foundColors
    warningColors

activeColors = {
    orange: false
    violet: true
    yellow: false
    green: true
    red: false
    blue: true
}

console.log findWarnings activeColors