
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
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] }
- Related Articles
- Difference between console.dir and console.log in javascript?
- JavaScript console.log() with Example
- How to provide new line in JavaScript alert box?
- Find a new line character with JavaScript RegExp.
- How to new line string - JavaScript?
- How to use a line break in array values in JavaScript?
- How do we use single line comments in JavaScript?
- How do we use multi-line comments in JavaScript?
- Search text containing a new line in MySQL?
- How can a new column be added to an existing dataframe in Python?
- How much should be a JavaScript Line Length?
- How can Keras be used to train a model with new callback in Python?
- Can the string be segmented in JavaScript
- How can I use goto statement in JavaScript?
- Difference between console.log and process.stdout.write in NodeJS

Advertisements