Is there a way to slice with javascript an array but not according to the index of the dimension but according to the content of its' j-th element (supposedly uniqueness of values)?
Example:
myArray = [["a", "b", "c"], ["car", "hat", "plate"], ["red", "green", "black"]]
Slicing myArray on 0,1 will give
[["c"],["plate"],["black"]]
and slicing on "black" should give the same result.
What is the use of my question? Say for example that my array comes from parsing the rows of a file and I want to slice upon the headers (first row), but the headers of the -to be parsed- files (although same) come in random orders.
Thanks
Array.indexOf('plate')0, 1? And why do these parameters produce the same value as calling with'black'as a parameter?Array; it's a constructor for arrays and redefining it will break a lot of things