XML Feeds

.

[javascript-dev] js question from a newbie

Patrick Delges pdelges at radiantslab.com
Thu Mar 27 02:11:01 MDT 2008


On 27 mars 08, at 02:29, Greg wrote:

> So i started reading about arrays in javascript and in my first  
> example (filling an array and printing it reversed) there is a  
> 'undefined ' message poping up in max window.
> Could anybody please let me know whats going on ?

> for (i = k ; i > 0 ; i--)

Let say your float message was 3.0, your i variable will first be 3,  
then 2 then 1 and the loop will stop. So myarray[0] will remain...  
"undefined".  Arrays in JavaScript start at index 0.

Note that your array's size will never decrease. So if you send 6.0 to  
your code, then 3.0, myarray.length will still be 7.


> _____________________________

Patrick Delges

Centre de Recherches et de Formation Musicales de Wallonie asbl
http://www.crfmw.be/max



More information about the javascript-dev mailing list