var caseOne = [
{"name":"Felicity", "gender":"F", ... ... ,"type":"Admin"},
{"name":"Tony", "gender":"M", ... ... ,"type":""},
.
.
.
.
{"name":"Super Man", "gender":"M", ... ... ,"type":""},
{"name":"Wonder Women", "gender":"F", ... ... ,"type":""},
{"name":"Hulk", "gender":"M", ... ... ,"type":"User"},
{"name":"Loky", "gender":"M", ... ... ,"type":"User"},
{"name":"Thore", "gender":"M", ... ... ,"type":"Admin"}
];
var caseTwo = [
{"name":"Felicity", "gender":"F", ... ... ,"type":"Admin"},
{"name":"Tony", "gender":"M", ... ... ,"type":""},
.
.
.
.
{"name":"Super Man", "gender":"M", ... ... ,"type":""},
{"name":"Wonder Women", "gender":"F", ... ... ,"type":""},
{"name":"Hulk", "gender":"M", ... ... ,"type":"User"},
{"name":"Loky", "gender":"M", ... ... ,"type":"User"},
{"name":"Thore", "gender":"M", ... ... ,"type":"Admin"},
{"name":"Bat man", "gender":"M", ... ... ,"type":""}
];
I have this kind of array. I want all records after lastIndexOf "type":"", means From cansOne it'll return last 3 record and from caseTwo it'll return 0 record. in short all records after "type":"". Can anyone help.
Thanks in advance.
Expected output
caseOne = [
{"name":"Hulk", "gender":"M", ... ... ,"type":"User"},
{"name":"Loky", "gender":"M", ... ... ,"type":"User"},
{"name":"Thore", "gender":"M", ... ... ,"type":"Admin"}
];
caseTwo = [];
type:""then it return 0 or if third last record hastype:""then it'll return last two records.