user3365120
user3365120

Reputation: 1

what is the meaning of a = [ ], i, j,len; in javascript where 'a' is any variable?

I have been reading a code written in java script where variables are assigned such values and I am unable to make out what exactly it is. Can anyone please specify ?

Upvotes: 0

Views: 534

Answers (2)

icktoofay
icktoofay

Reputation: 129079

var a = [], i, j, len;

defines four variables, a, i, j, and len, and gives a an initial value of an empty array.

Upvotes: 6

user1932079
user1932079

Reputation:

It's not "any variable", it's an array. You can change that later b/c javascript is not strongly typed. The list of things separated by commas just defines them as existing.

Upvotes: 0

Related Questions