JSFiddle - React, Tailwind, and code Playground
by rossipedia
HTML
<div id="output"></div>
JavaScript
var Palette = function() {
this.colors = ["red", "green", "blue"];
this.getColorCombinations = function() {
var combos = [];
this.colors.forEach(function(a) {
this.colors.forEach(function(b) {
if(a !== b) {
combos.push([a, b]);
}
});
}, this);
return combos;
};
}
var p = new Palette();
document.getElementById('output').innerHTML = JSON.stringify(p.getColorCombinations());