I have a Multidimensional array as shown below:
[
["1","success","5"],
["2","success","5"],
["3","success","5"],
["4","fail","5"],
["5","fail;","5"],
["6","fail","5"],
["7","success","5"],
["8","fail","5"],
];
what I need is to select particular rows based on the success
and fail
type. which means for eaxmple i have to only get the data whose second column is named success
I have written a code but it gives me values in separate arrays. I want the data in this format
[
["1","success","5"],
["2","success","5"],
["3","success","5"],
["7","success","5"],
]
The code that I have tried is the folllowing:
var success = [];
for(var i=0;i<arr.length;i++)
{
if(arr[i][1] =='success')
{
success = [arr[i]];
console.log(success);
}
}
I want all the data in single array. Here is the Fiddle Link that I Tried: https://jsfiddle.net/abnitchauhan/09zchjak/