Home / Advanced JavaScript Tutorials / Creating dense arrays |
CodingForums Jump to...
- CSS Drive
- JavaScript Menus - PHP Resources - Hotels & Vacations - Java Online Casinos - Web hosting Search |
In Netscape 3 and up, access-by-name support was added to dense arrays. This means a programmer can access the values of a dense array not only through the value's index number, like above, but also, through its name. For example, the below also alerts "one": alert(myarray["one"]) //alerts "one" There are no particular advantages to accessing a dense array through the value's name other than that it provides better documentation (others can more readily see which values are being accessed). Lets now demonstrate the true power of dense arrays by showing how it can significantly lessen the code required to create a script that writes out the current date and time. -Tutorial introduction Example: Writing out the current date and time using dense arrays |
http://javascriptkit.com |