Basic JavaScript - Updating Object Properties

Tell us what’s happening:
can i use console.log in this instance .

Your code so far

// Setup
console.log (myDog)()
const myDog = {
  "name": "Coder",
  "legs": 4,
  "tails": 1,
  "friends": ["freeCodeCamp Campers"]
};

// Only change code below this line
myDog.name = "Happy Coder";

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:108.0) Gecko/20100101 Firefox/108.0

Challenge: Basic JavaScript - Updating Object Properties

Link to the challenge:

Well, not like that

Syntax for function calls would be

func(thing)

not

func (thing)()

And if you fix that, then you’ve done

func(thing)

thing doesn’t exist at that point, because you don’t define what thing is until the next line. Code is evaluated top to bottom (with some caveats that can alter the order). So you can’t write some code that accesses something before you actually create the something you’re trying to access.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.