0

I tried to print the objects in console window as the following but I am not getting the object instead it is saying "Undefined". Any suggestions?

var details = [
    {
        name:"Anita", 
        age:"20"
    },{
        name: "Helen", 
        age:"21"
    }
];

console.log(details) //undefined

console.log(details) //undefined

console.table(details) //undefined
Matt
  • 1,062
  • 1
  • 8
  • 11
Helen Anita
  • 143
  • 1
  • 2
  • 12

1 Answers1

0

Press F12, to show the developer console.

Navigate to the source file where you are doing that console.log(details); left click at the left of that line (on the line number) to create a breakpoint.

Reload your page and the code will run to that breakpoint and stop. Now you can right click on details in the code and chose evaluate in console.

If it still shows undefined, that is your problem.

You have now learned a new and very useful skill. Get into the habit of using the developer console. Breakpoints are your friends. You can evaluate & change variables and see the call stack + more

Mawg says reinstate Monica
  • 38,334
  • 103
  • 306
  • 551