Benefits of declaring variable type through assignment in JavaScript -
in javascript, there benefit in assigning temporary value newly declared variable? example...
var = 0, b = ''; // somewhere else = 5; b = 'goodbye';
vs
var a, b; // somewhere else = 5; b = 'goodbye';
i'm aware assigning variable on declaration set type. in javascript, can changed assigning value of different type, doesn't protect in way.
what advantages/disadvantages of above?
i believe advantage is: order in code. you'll know right beginning of code type var.
the disadvantage more code lines , size of file.
Comments
Post a Comment