São iguais?

Crie uma função que receba dois objetos e uma chave.

  1. Retorne true se ambos os objetos contiverem a chave com valores iguais.
  2. Retorne "One's empty" se exatamente um dos objetos contiver a chave.
  3. Retorne "Not the same" se os objetos contiverem valores diferentes ou se nenhum deles contiver a chave.

Exemplos

checkSame({ sky: "temple", horde: "orcs", people: 12, story: "fine", sun: "bright" }, { people: 12, sun: "star", book: "bad" }, "horde") // "One's empty"

checkSame({ sky: "temple", horde: "orcs", people: 12, story: "fine", sun: "bright" }, { people: 12, sun: "star", book: "bad" }, "people") // true

checkSame({ sky: "temple", horde: "orcs", people: 12, story: "fine", sun: "bright" }, { people: 12, sun: "star", book: "bad" }, "sun") // "Not the same"

Observações

  • A ordem das chaves é irrelevante.
  • Uma chave com um valor null ou undefined ainda conta como presente.