javascript - check if value exists in 2D array -
javascript - check if value exists in 2D array -
i have 2d array in format
emi_309 | nowadays | weak | 6 emi_310 | nowadays | strong | 9 emi_319 | nowadays | medium | 8 emi_315 | nowadays | weak | 5
i want check if value exists in first column using simple function
e.g, check if emi_77 exists in first column
i came across $.inarray(value, array)
function 1d array only.
is there similar 2d array
yes, if combination of $.inarray
, $.map
:
if ($.inarray(value, $.map(arr, function(v) { homecoming v[0]; })) > -1) { // ... }
javascript jquery
Comments
Post a Comment