JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/ui-lightness/jquery-ui.css">
<img src = "http://dummyimage.com/120x90/f00/fff.png&text=my+image" />
JavaScript
var first = ["red", "blue", "yellow"];
var second = ["orange", "purple", "green"];
var third = ["brown", "black", "white"];
function inArrays(val) {
var arrays = Array.prototype.slice.call(arguments, 1);
var len = 0;
var i = 0;
var idx = $.inArray(val, [].concat.apply([], arrays));
var ret = {
index: idx,
array: null
};
if (idx > -1) {
do {
ret.array = arrays[i]
ret.index = idx - len;
len += arrays[i].length;
i++;
} while (idx >= len)
}
return ret;
}
console.log(inArrays('white', first, second, third));