Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Declaring multiple empty variables

I tried doing this:

var1, var2, var3 = {}

and only the last var was an object, is i posible to create multiple empty objects or arrays without doing

var all = {}, used = {}, unused = {};

?

like image 504
ilyo Avatar asked Oct 22 '22 11:10

ilyo


1 Answers

What you wrote is similar to :

var1;
var2;
var3 = {};

What you need is :

var1 = var2 = var3 = {};
like image 114
Pavel Avatar answered Oct 24 '22 10:10

Pavel