challenges

Object Notation: Dot vs Bracket

The goal of today’s code is to find cats with a “talkative” personality and create an array of their names, but this code won’t do the trick. Where’s the error?

Code with error

const cats = {
  moxie: {
    color: "calico",
    personality: "talkative",
  },
  gus: {
    color: "orange",
    personality: "mellow",
  },
};
 
const talkativeCatNames = Object.keys(cats).filter(
  (catName) => cats.catName.personality === "talkative"
);