The function called vegan
receives an object guests
as an argument. In the object we have objects that represent the guests at a party where everyone has a vegan
property with a boolean. I have to return the number of guests who are vegan.
Example:
let invitados = {
Luna: {
vegan: false
},
Sebas: {
vegan: false
},
Marce: {
vegan: false
},
Nicky: {
vegan: true
}
};
// vegan(invitados) returns 1
var contador = 0;
for (var i = 0; i < vegan.length; i++) {
if (invitados.vegan = true) {
contador = contador + 1;
}
}
return contador;