本文介绍了当在控制台中跟踪变量时,如何创建新行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我想做一些简单的事情,我想使用1 console.log语句将我的控制台中的跟踪分成几行:
console.log('roleName ='+ roleName +'role_ID ='+ role_ID +'modal_ID ='+ modal_ID + \\\
+'related ='+ related);
如何写上述内容来追踪以下内容?
roleName = test
role_ID = test
modal_UD = test
related = test
而不是roleName = test role_ID = test modal_UD = test related = test
检查了几个似乎相似的其他问题,但没有一个帮助或正在谈论不同的事情。
感谢您来看看!
解决方案您应该将它包含在引号
'\\\
b
'
$ bconsole.log('roleName ='+ roleName +'\\\
'+
'role_ID ='+ role_ID +'\\\
' +
'modal_ID ='+ modal_ID +'\\\
'+
'related ='+ related);
So I'm trying to do something simple, I want to break up my traces in the console into several lines, using 1 console.log statement:
console.log('roleName = '+roleName+' role_ID = '+role_ID+' modal_ID = '+modal_ID+\n+'related = '+related);
How would you write the above to trace out the following?
roleName = test role_ID = test modal_UD = test related = test
instead of roleName = test role_ID = test modal_UD = test related = test
I've checked out several other questions which appear similar, but none have helped or are talking about a different thing.
Thanks for taking a look!
解决方案You should include it inside quotes
'\n'
, See below,console.log('roleName = '+roleName+ '\n' + 'role_ID = '+role_ID+ '\n' + 'modal_ID = '+modal_ID+ '\n' + 'related = '+related);
这篇关于当在控制台中跟踪变量时,如何创建新行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!