JSFiddle - React, Tailwind, and code Playground

JavaScript

function Something(pallet, colors) {
    var myColors = colors;
    var myPallet = pallet;

    function getColors() {
        for (var i = 0; i < myColors.length; i++) {
            document.write(myColors[i] + "<br />");
        }
    }

    return {
        getColors: getColors
    };
}


var mySomething = new Something('myNewPallet', ['green', 'red', 'blue']);
mySomething.getColors();