Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

310
Views
How come when I console log a DOM element in VS code, I sometimes receive an HTML like tree and sometimes I receive JSON properties

I am new to the DOM and I am console logging things so I can see what my code is doing to my website without implementing it right away.

I have read the documentation about console.log and console.dir

I am confused because I am using VS code and sometimes my console.log() behaves as a console.dir() when I am looking at the chrome console.

This is frustrating me because to check if an attribute I am creating is working as I want it to, I have to scroll down all the properties to find the one I want.

For an example, if I am logging a variable xyz that is a div with a class of test.

input --> console.log(xyz)

output --> div.test

the output has a drop down with all the possible properties of div... many of them null. If I scroll down to className it says test so I know it worked correctly

How do I get it so it shows

This would make everything I do much faster

It does this sometimes but if I refresh it reverts back to that JSON like tree

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!