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 primary   = ["red", "blue", "yellow"];
var secondary = ["orange", "purple", "green"];

var plen = primary.length;
var slen = secondary.length;

var idx = $.inArray( 'purple', primary.concat( secondary ) );

if( idx === -1 ) {
    alert( 'not found' );
} else if( idx < plen ) {
    alert( idx + ' in primary' );
} else {
    alert( (idx - plen) + ' in secondary' );
}