JSFiddle - React, Tailwind, and code Playground

by Andrey Gershun

HTML

<script src="http://alasql.org/console/alasql.min.js"></script>
<p>New Fruits: <span id="result"></span></p>

JavaScript

var data = { COLORS: [[1,"red"],[2,"yellow"],[3,"orange"]],            
   "FRUITS":[[1,"apple"],[2,"banana"],[3,"orange"]]};

data.NEW_FRUITS = alasql('SELECT MATRIX COLORS.[0], COLORS.[1], FRUITS.[1] AS [2] FROM ? AS COLORS JOIN ? AS FRUITS ON COLORS.[0] = FRUITS.[0]',[data.COLORS, data.FRUITS]);

document.getElementById("result").textContent = JSON.stringify(data.NEW_FRUITS);