Created
April 3, 2021 15:05
-
-
Save vishalkukreja/258f4bb26bc204867b19228747cf0c1d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var empEligibilityDetails = [ | |
{ | |
"name": "Vishal", | |
"age": 30, | |
"isManager": false, | |
"city": "Mumbai" | |
}, | |
{ | |
"name": "Kunal", | |
"age": 31, | |
"isManager": false, | |
"city": "Pune" | |
}, | |
{ | |
"name": "Ajay", | |
"age": 32, | |
"isManager": true, | |
"city": "Thane" | |
}, | |
{ | |
"name": "Rahul", | |
"age": 36, | |
"isManager": true, | |
"city": "Mumbai" | |
} | |
]; | |
var empData = empEligibilityDetails.find(value => value.age > 31); | |
console.log(empData); | |
//If you want to skip 1st record, you can play with index passed in argument | |
var empNewData = empEligibilityDetails.find((value, i) => { | |
if (value.age > 28 && i !== 0) return true; | |
}); | |
console.log(empNewData); | |
empEligibilityDetails.find(value => value.age > 31).isManager = false; | |
console.log(empEligibilityDetails); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment