JSFiddle - React, Tailwind, and code Playground

by Andrey Gershun

HTML

<script src="http://alasql.org/console/alasql.min.js"></script>
<p>Result 1: <span id="res1"></span></p>

JavaScript

var dataArray = [ 
  { id: "a", score: 1 }, 
  { id: "b", score: 2 }, 
  { id: "c", score: 5 }, 
  { id: "a", score: 3 },
  { id: "c", score: 2},
 ];

var res1 = alasql('SELECT id, SUM(score) AS score FROM ? GROUP BY id',[dataArray ]);



document.getElementById("res1").textContent = JSON.stringify(res1);