[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LOGO-L> eliminating items randomly from a list



Bill Kerr wrote:
> In JavaScript there is the option of keeping arrays open ended,
> 
> eg. you can write
> 
> textArray = new Array();
> 
> rather than
> 
> textArray = new Array(21);
> 
> -- Bill Kerr

In JavaScript (as in many scripting languages) arrays automatically
resize.  So in the above example I could refer to textArray[100] in
either case.  There is no advantage to pre allocating array slots in
JavaScript.  Javascript 1.1 also supports associative arrays. That is
slots be accessed by name as well as value. For example:

earth = new Array()
earth.diameter = "7920 miles"

Now you can access the value by:
earth.diameter  
or
earth["diameter"]  

This is very similar to property lists in MSWLogo. It is my personal
belief that property lists are one of the strongest features of MSWLogo. 


-- 
Frank Caggiano
caggiano@atlantic.net
http://www.atlantic.net/~caggiano
---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org.  Mail
questions about the list administration to logofdn@gsn.org.  To
unsubscribe send    unsubscribe logo-l    to majordomo@gsn.org.



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home