This content has been marked as final. Show 4 replies
hmmm i have been using .length without () and it has been working just fine
you sure about that?
Actually both of you are right....
I have found the following situations:
If your data is of type ArrayCollection or Array, etc. you can use the "length" property.
If your data is of type XML or XMLList, etc you use "length()" function.
I am sure there are other types that fall under both categories but that is just the few that I can think of off the top of my head that I have run across.
And yes, Jorshasaur is correct it will compile no errors thrown and just does bascially nothing so if you expect data and know all else is good, debug that issue.
Hope this clarifies this a bit.
Just a note - why people are using Number data type in simple loops or counters?
Number - is a float double precision value. And you will face all consequences of real numbers, like 20/2 = 10.0000000002
Use int or uint - they are far more efficient for this.
Get real, use int :)
No excuse, just a matter of time to go back and change that code. int and uint are new and Number still runs...
It IS best prectice to use the most restrictive data type that fits your requirements.