0

This is my code:

// Task 1
var dairy = ['cheese', 'sour cream', 'milk', 'yogurt', 'ice cream', 'milkshake']
const logDairy = () => {
  for (const item of dairy) {
    console.log(item);
  }
}
logDairy();

const animal = {
  canJump: true
};
const bird = Object.create(animal);
bird.canFly = true;
bird.hasFeathers = true;

// Task 2
const birdCan = () => {
  for (const key of bird) {
    console.log(`${key}: ${Objects.value[item]}`);
  }
}
birdCan();

// Task 3
const animalCan = () => {
  for (const key in animal) {
    console.log(key);
  }
}
animalCan();

I get this error:

Uncaught TypeError: bird is not iterable

I am trying to get this output:

The expected output should be:

cheese
sour cream
milk
yogurt
ice cream
milkshake

canFly: true
hasFeathers: true

canFly: true
hasFeathers: true
canJump: true
Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339

0 Answers0