DEV Community

Johannes Millan
Johannes Millan

Posted on

11 2

Just a little trick for debugging

// instead of
console.log('someVar', someVar);

// I now often just do this:
console.log({someVar});
console.log({someVar, someOtherVar});
Enter fullscreen mode Exit fullscreen mode

Might not be a new idea to some of you while others will frown upon using console.log at all. I still like to share this neat little "trick" to label my variables when logging.

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay