Object Basics revision

See the Pen Object basics 1 by lTakisl (@ltakisl) on CodePen.

See the Pen Object basics 2 by lTakisl (@ltakisl) on CodePen.

See the Pen Object basics 2 by lTakisl (@ltakisl) on CodePen.

If there is something that I should modify or do in a better way, please tell me, thank you.

Hi @Takis

Good job on this tasks! Here are some small improvements:

  • Task 1: cat.greeting(); is enough. No need to put it inside console.log() The function itself logs already ‘Meow!’ to the console. Your are logging the return value of the function. That’s the reason ‘undefined’ appears in the console.

  • Task 2: In your albums array you grouped the names in one object and the release years in another object. It will be much easier to put the name and the release year of an album together in one objects:

    albums : [
      {
         nombre: 'De corazón a corazón',
         fecha: 1992
      },
      {
         nombre: 'La única',
         fecha: 1993
      },
      ...
    

    This way you won’t have to prefix ‘nombre’ and ‘fecha’.

  • Task 3: Your code is correct. You just missed the function calls at the end:

    cat.greeting();
    cat2.greeting();
    

If you have any questions feel free to ask :slightly_smiling_face:

Happy coding!
Michael

1 Like