Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does variable declaration with multiple comma separated values mean (e.g. var a = b,c,d;)

When I try to understand plugin codes, I often find these kind of declarations but I don't know exactly what it means.

var a = b,c,d;

like image 950
Daryl Macam Avatar asked Jun 18 '12 03:06

Daryl Macam


1 Answers

This is a syntactic shorthand, and identical to:

var a = b; var c; var d; 

The first one (a) gets initialized with the value of b, but c and d are uninitialized.

like image 170
Chris Trahey Avatar answered Sep 22 '22 11:09

Chris Trahey