Last active
January 28, 2020 05:03
-
-
Save arcticmouse/9659a274cb4812ddceb4b4cc6c5691c5 to your computer and use it in GitHub Desktop.
techtonica dogs
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
let dogs = [ | |
{name:'Osito', age: 15}, | |
{name:'Nana', age: 1}, | |
{name:'Bella', age: 8}, | |
] | |
function filterDogs(minimumAge){ | |
let dogs2 = [] | |
for(let i = 0; i<dogs.length; i++){ | |
if(minimumAge <= dogs[i].age) | |
dogs2.push(dogs[i]) | |
} | |
return dogs = dogs2 | |
} | |
filterDogs(10) | |
console.log(dogs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment