-
Notifications
You must be signed in to change notification settings - Fork 0
indexLast(arrayObject,query)
Bhumil Sarvaiya edited this page Aug 25, 2017
·
3 revisions
The function will return index of last object in array which satisfy the query passed.
If no object satisfy the condition, null will be returned.
var daex = require('json-daex')
var obj = [
{
name: 'abc',
type: 'array',
age: 20
},
{
name: 'pqr',
type: 'string',
age: 20
},
{
name: 'xyz',
type: 'array',
age: 22
},
{
name: 'ghi',
type: 'array',
age: 20
},
{
name: 'mno',
type: 'number',
age: 20
}
]
console.log(daex.indexLast(obj,{'type':'array'}))
//get index of last object with type: array
// Output: 3