Skip to content Skip to sidebar Skip to footer

Finding Commonality In Object Days

I have an array of objects where I want to find out what consecutive days are the most common between all of them and then choose the first day of that consecutive day pair. let da

Solution 1:

You can use alasql https://github.com/agershun/alasql/wiki/Examples

with alasql can you make: DISTINCT or GROUP etc.

example:

// Fill table with data
var person = [ 
    { name: 'bill' , sex:'M', income:50000 },
    { name: 'sara' , sex:'F', income:100000 },
    { name: 'larry' , sex:'M', income:90000 },
    { name: 'olga' , sex:'F', income:85000 },
];

// Do the query
var res = alasql("SELECT * FROM ? person WHERE sex='F' AND income > 60000", [person]);

document.getElementById("result").innerHTML = JSON.stringify(res);

Post a Comment for "Finding Commonality In Object Days"