Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
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
