如何在节点的console.log()中创建换行符 [英] how to create line breaks in console.log() in node

查看:57
本文介绍了如何在节点的console.log()中创建换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

打印多个对象时,是否可以在console.log中获取新行?

Is there a way to get new lines in console.log when printing multiple objects?

假设我们有 console.log(a,b,c),其中 a b c 是对象.有没有办法在对象之间换行?

Suppose we have console.log(a,b,c) where a, b, and c are objects. Is there a way to get a line break between the objects?

我尝试了 console.log(a,'\ n',b,'\ n',c),但这在节点中不起作用

I tried console.log(a,'\n',b,'\n',c) but that does not work in node

推荐答案

我不知道为什么它可以在节点中工作,但是以下似乎可以解决问题:

I have no idea why this works in node but the following seems to do the trick:

console.log('',a,'\n',b,'\n',c)

TheBlueFish的功能

compliments of theBlueFish

这篇关于如何在节点的console.log()中创建换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆