Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
September 11, 2022 06:13 am GMT

Object logging in Console Node Quick Notes.

Remember we require console to debug javascript so below will be usefull.

  1. Node do not logs objects as javasript does after certain level, to do so use console.log(JSON.stringify(obj, null, 2)); or set require('util').inspect.defaultOptions.depth = null;
    .

  2. if above is hard then just use string format and do below.

// %o tells console.log() to string-format and log obj in its placeconsole.log('%o', obj);

Original Link: https://dev.to/ajaybaraiya6/object-logging-in-console-node-quick-notes-jdm

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To