When I try to create a variable named length
var length = 10;
JSLint complaints
Redefinition of 'length'. var length = 10;
But where does that length
come from?
When I try to create a variable named length
var length = 10;
JSLint complaints
Redefinition of 'length'. var length = 10;
But where does that length
come from?
window
already has length
defined:
If you had, say, an array:
howlong=myarray.length;
would return the number of elements in the array.
If you had a string:
howlong=mystring.length;
would return the number of characters in the string.
Long story short, 'length' is used all over the place. Most useful.