why is el+ = v[i] different from el+=v[i] ?
i thought javascript doesn't care about spacing.
thanks, Any answers are appreciated it. and please don't put my question on hold. i'm here trying to learn.
var v = ['a','b','c','d','e'];
var el="";
for(i=0; i<v.length; i++){
el+ = v[i]; // not working because of spaces, but why?
// el+=v[i]; // working
}
document.write(el);
+ =is not the same as+=. If you want to make it easier to read do it like this:el += v[i];that would be allowed