filter table using vanilla js
Sigiloso
Assuming it's a simple "equal" filter and the table is a 2-dimensional array like this- var table = [ ['name', 'occupation', 'age'], ['Roy1', 'Software Engineer', '29'], ['Roy2', 'Software Engineer', '26'] ]; I'd go with - function filterTable(table, param, value) { var paramIndex = table[0].indexOf(param); return table.reduce(function (acc, row) { if (row[paramIndex] === value) { acc.push(row); } return acc; }, []) } And then, for example for the input - filterTable(table, 'age', '29') I'd get back - [['Roy1', 'Software Engineer', '29']]