- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
In JavaScript, can be use a new line in console.log?
Yes, we can use a new line using “
” in console.log(). Following is the code −
Example
const studentDetailsObject = new Object() studentDetailsObject.name = 'David' studentDetailsObject.subjectName = 'JavaScript' studentDetailsObject.countryName = 'US' studentDetailsObject.print = function(){ console.log('hello David'); } console.log("studentObject", "
", studentDetailsObject);
To run the above program, you need to use the following command −
node fileName.js.
Here, my file name is demo170.js.
Output
This will produce the following output −
PS C:\Users\Amit\javascript-code> node demo170.js studentObject { name: 'David', subjectName: 'JavaScript', countryName: 'US', print: [Function] }
Advertisements