如何在Javascript中的console.log()中插入一个介绍(How to insert an intro in console.log() in Javascript)

编程入门 行业动态 更新时间:2024-10-19 20:37:08
如何在Javascript中的console.log()中插入一个介绍(How to insert an intro in console.log() in Javascript)

我想用console.log()打印一些文本。 我有几行,每个我用过一个console.log()。 我想创建2个段落。 我怎么能这样做? 谢谢

	console.log("1 : Lister les contacts"); //paragraph 1
	console.log("2 : Ajouter un contact");  //paragraph 1
	console.log("0 : Quitter");  //paragraph 1
	console.log("Choisissez une option :")); //paragraph 2
	
	 
  
 

I would like to print some text using console.log(). I have several lines, a for each one I have used a console.log(). I would like to create 2 paragraphs. How could I do it? Thanks

	console.log("1 : Lister les contacts"); //paragraph 1
	console.log("2 : Ajouter un contact");  //paragraph 1
	console.log("0 : Quitter");  //paragraph 1
	console.log("Choisissez une option :")); //paragraph 2
	
	 
  
 

最满意答案

console.log("1 : Lister les contacts"); //paragraph 1
console.log("2 : Ajouter un contact"); //paragraph 1
console.log("0 : Quitter"); //paragraph 1
console.log(""); //paragraph 1
console.log("Choisissez une option :"); //paragraph 2 
  
 

或者,您可以使用\n打破这条线并使用两次\n\n来打破两条线:

console.log("   p1 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. \n\n   p2 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. "); 
  
 

console.log("1 : Lister les contacts"); //paragraph 1
console.log("2 : Ajouter un contact"); //paragraph 1
console.log("0 : Quitter"); //paragraph 1
console.log(""); //paragraph 1
console.log("Choisissez une option :"); //paragraph 2 
  
 

Or you can use \n to break the line and use two time \n\n to break two line:

console.log("   p1 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. \n\n   p2 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. "); 
  
 

更多推荐

本文发布于:2023-08-02 19:55:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1379593.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何在   Javascript   console   intro   insert

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!