Data Structure
 Networking
 RDBMS
 Operating System
 Java
 MS Excel
 iOS
 HTML
 CSS
 Android
 Python
 C Programming
 C++
 C#
 MongoDB
 MySQL
 Javascript
 PHP
- Selected Reading
 - UPSC IAS Exams Notes
 - Developer's Best Practices
 - Questions and Answers
 - Effective Resume Writing
 - HR Interview Questions
 - Computer Glossary
 - Who is Who
 
How can I declare and define multiple variables in one statement with JavaScript?
To declare and define multiple variables in one statement, you can use below syntax −
var anyVariableName1=yourValue1, anyVariableName2=yourValue2, anyVariableName3=yourValue3, anyVariableName4=yourValue4, . . N
Example
var firstName="My First Name is David", lastName="My Last Name is Miller", place="I live in AUS"; console.log(firstName); console.log(lastName); console.log(place);
To run the above program, you need to use the following command −
node fileName.js.
Here, my file name is demo182.js.
Output
This will produce the following output −
PS C:\Users\Amit\javascript-code> node demo182.js My First Name is David My Last Name is Miller I live in AUS
Advertisements