We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JavaScript 中在用 console.log 输出变量时,如果变量层级比较复杂,那么会输出 { e: 'e', f: [Object] } 这样的变量值。
console.log
{ e: 'e', f: [Object] }
如果要完整显示变量的每一层内容,并且将输出格式化(pretty-print),就需要进行特定的设置了。
pretty-print
Google node.js beautify print nested object content,在 How can I pretty-print JSON using node.js? 中有一个优雅的解决方案:JSON.stringify(someObject, null, 2) 即可实现该需求。
node.js beautify print nested object content
JSON.stringify(someObject, null, 2)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
需求描述
JavaScript 中在用
console.log
输出变量时,如果变量层级比较复杂,那么会输出{ e: 'e', f: [Object] }
这样的变量值。如果要完整显示变量的每一层内容,并且将输出格式化(
pretty-print
),就需要进行特定的设置了。解决过程
Google
node.js beautify print nested object content
,在 How can I pretty-print JSON using node.js? 中有一个优雅的解决方案:JSON.stringify(someObject, null, 2)
即可实现该需求。The text was updated successfully, but these errors were encountered: