Created
January 26, 2019 09:20
-
-
Save priyankaa02/2cfd9c22f3821f8dd8b92c8f6650054a to your computer and use it in GitHub Desktop.
finding age between 30 and 40
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
function peopleArray(listOfPeople){ | |
let filteredArray = [] | |
for ( var i = 0; i < listOfPeople.length; i++){ | |
if(listOfPeople[i].age > 30 && listOfPeople[i].age < 40){ | |
filteredArray.push(listOfPeople[i]) | |
} | |
} | |
return filteredArray | |
} | |
people = [ | |
{id : "1", name : "abc", gender : "m", age :"15" }, | |
{id : "2", name : "a", gender : "m", age :"25" }, | |
{id : "3", name : "efg", gender : "f", age :"5" }, | |
{id : "4", name : "hjk", gender : "m", age :"35" }, | |
{id : "5", name : "ikly", gender : "m", age :"41" }, | |
{id : "6", name : "ert", gender : "f", age :" 30" }, | |
{id : "7", name : "qwe", gender : "f", age :" 31" }, | |
{id : "8", name : "bdd", gender : "m", age :" 78" } | |
] | |
var result = peopleArray(people) | |
console.log(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment