tags:

views:

97

answers:

1

hi all, can you explain how did this assignment is work,

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

which one equal to which one.

+10  A: 

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.

SolutionYogi
fe and h won't be *null*, they will be *undefined*... http://is.gd/1ETFN
CMS
thank you very much
Kombuwa
Thanks CMS, I corrected my post. My C# and JS knowledge gets me confused!
SolutionYogi
You're welcome SolutionYogi, and you're not alone!, that also happens to me sometimes...
CMS