JSFiddle - React, Tailwind, and code Playground
JavaScript
Array.prototype.vlookup = function(needle,index,exactmatch){
index = index || 0;
exactmatch = exactmatch || false;
for (var i = 0; i < this.length; i++){
var row = this[i];
if ((exactmatch && row[0]===needle) || row[0].indexOf(needle) != -1)
return (index < row.length ? row[index] : row);
}
return null;
}
var table = [
['A', 'Hello, World', 'World'],
['B', 'Hello, Foo', 'Foo'],
['C', 'Hello, Bar', 'Bar']
];
$('body').append($('<p>').text(table.vlookup('B',1)));