Closed RazvanBugoi closed 4 years ago
function getNiceNames(people){
let obj = people.filter((el,index) => people[index]['wasNice'] == true);
let output = [];
if (obj.length > 0) {
for (let i=0; i<obj.length; i++){
output.push(obj[i]['name']);
}
}
return output;
};
function getNaughtyNames(people){
let obj = people.filter((el,index) => people[index]['wasNice'] == false);
let output = [];
if (obj.length > 0) {
for (let i=0; i<obj.length; i++){
output.push(obj[i]['name']);
}
}
return output;
}
https://www.codewars.com/kata/52a6b34e43c2484ac10000cd/train/javascript