Kombuwa
Kombuwa

Reputation: 1651

JavaScript assignment

can you explain how did this assignment is work,

var fe, f = document.forms[0], h;

which one equal to which one.

Upvotes: 1

Views: 275

Answers (1)

SolutionYogi
SolutionYogi

Reputation: 32233

Above is equivalent to

var fe;
var f = document.forms[0];
var h;

Basically, the 'comma' ends one declaration and starts another. fe and h would be undefined after the above statement whereas f will be set to first form in the document.

Upvotes: 9

Related Questions