JSFiddle - React, Tailwind, and code Playground
JavaScript
var mapping = [ //response.mapping
["userOne", 1],
["userTwo", 2],
["userthree", 3],
["userfour", 4],
["personOne", 1],
["personTwo", 2],
["personOne", 3],
];
var findIndex = function (hayStack, needle) {
for (var i = 0; i < hayStack.length; i++) {
if(hayStack[i][0] === needle[0] && hayStack[i][1] === needle[1]) {
return i;
}
}
return -1;
};
var captured_list_elm = ["personOne", 1];
var status = findIndex(mapping, captured_list_elm);
alert("status= "+status);