Wrap text
Report abuse
function getPositionInMatrix(needle, haystack, pos)
{
pos = pos || [];
for(var i = haystack.length; --i >= 0;)
{
if(haystack[i] === needle)
{
return pos.push(i);
}
else if(Object.prototype.toString.call(haystack[i]) === '[object Array]')
{
pos.push(i);
if(getPositionInMatrix(needle, haystack[i], pos))
{
return pos;
}
else
{
pos.pop();
}
}
}
return false;
}