Anonymous

2008-02-21

Javascript

Filed under: Web Dev — anonymous @ 1:12 am and tagged ,

1. two ways to iterate an array
var results = new Array();
//...
for (var i = 0; i < results.length; i++){
//...
//Only useful when the results is not built as an associative array, but a simple number-indexed array.
// results['1st'] = 111;
// results['2nd'] = 222;
// results.length is 0 actually.
}
for ( var tmp in results ){
// tmp is the key. results[tmp] is the value.
// When you use prototype of an object, you get them in this way
// e.g key is the function name, value is the function body...
// All are objects.
}

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

generiert in 0.253 Sekunden. | Powered by WordPress.