people.forEach(function(node) { if (node.age <= 20) peopleTo20.push(node); else if (node.age <= 30) peopleFrom21To30.push(node); else peopleFrom31.push(node) })