
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
Best Way to Declare Multiple Variables in JavaScript
Definitely, the following way of declaring multiple variables is more efficient:
var variable1 = 5; var variable2 = 3.6; var variable3 = “Amit”;
Suppose you need to add, remove, or update a variable, then you can easily do it.
But with the following method, you need to do more changes. For example, on removing a variable, you need to remove the semi-colon. If it’s the first, then you need to add var to the second variable.
var variable1 = 5, variable2 = 3.6, variable3 = “Amit”
Advertisements