Who's the owner?

Report a typo

In the code below you have a function named switchTheValues that gets an array with two objects inside. Each object has the following structure:

{
  name: '...',
  breed: '...',
  owner: '...',
}

The person who created this object got the cat's name mixed up with the name of its owner. Your task is to fix this mistake.
Switch the value of the key name with the value of the key owner and print it with the following sentence:
... has a cat named ..., whose breed is ...

Replace the dots with the corresponding variables.

Hint:

Do not forget to iterate through each item in the object using relevant methods.

Sample Input 1:

[{"name":"Paul","breed":"Siamese","owner":"Bella"},{"name":"Lucia","breed":"Norwegian Forest","owner":"Lilly"}]

Sample Output 1:

Paul has a cat named Bella, whose breed is Siamese
Lucia has a cat named Lilly, whose breed is Norwegian Forest
Write a program in JavaScript
function switchTheValues(cats) {

}
___

Create a free account to access the full topic