JSFiddle - React, Tailwind, and code Playground

JavaScript

function Pallet(palletName, palletColors) {
    this.name = palletName;
    this.colors = palletColors;
}

Pallet.prototype.getColor = function(color) {
    if (this.colors.indexOf(color) > -1) {
        return 'Color found';
    }

    return 'Color not found';
};


var myPallet = new Pallet('myNewPallet', ['green', 'red', 'blue']);
document.write(myPallet.getColor('red'));