Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In javascript, what do multiple equal signs mean? [duplicate]

Tags:

I saw this code somewhere, but what does it mean? (all a, b, c are defined previously)

var a = b = c;
like image 500
Maria Avatar asked Jan 19 '14 10:01

Maria


1 Answers

It quickly assigns multiple variables to a single value.

In your example, a and b are now equal set to the value of c.

It's also often used for a mass assign of null to clean up.

a = b = c = d = null;
like image 126
Alex Wayne Avatar answered Sep 22 '22 03:09

Alex Wayne