-
Notifications
You must be signed in to change notification settings - Fork 664
How to count matching values in array
agershun edited this page Dec 28, 2014
·
1 revision
Source: StackOverflow.com
What is a any good algorithm/code to get list of unique values from array and count of its occurrence in array?
The example:
var data = [1,2,3,4,3,2,3,4,5,3,2,1,1,1,2];
var res = alasql('SELECT INDEX _, COUNT(*) FROM ? GROUP BY _',[data]);
You can try this example at jsFiddle;
© 2014-2024, Andrey Gershun & Mathias Rangel Wulff
Please help improve the documentation by opening a PR on the wiki repo