Comma in variable declaration | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Comma in variable declaration

I came across a play quiz question that had this... var a,b,c; What is this madness!? Is this just shorthand for declaring 3 separate undefined variables? Or would it just be one variable?

10th Nov 2018, 3:20 AM
Foobatboy
Foobatboy - avatar
3 Answers
+ 6
Haha, yes. It's equivalent to var a; var b; var c;
10th Nov 2018, 3:26 AM
Kishalaya Saha
Kishalaya Saha - avatar
+ 3
thank you!!
10th Nov 2018, 3:32 AM
Foobatboy
Foobatboy - avatar
+ 1
You're welcome! :)
10th Nov 2018, 3:36 AM
Kishalaya Saha
Kishalaya Saha - avatar