Array-like object in javascript
问题 Looking through the dom.js source from the Closure library I found this (in goog.dom.getElementsByTagNameAndClass_ ): if (opt_class) { var arrayLike = {}; var len = 0; for (var i = 0, el; el = els[i]; i++) { var className = el.className; // Check if className has a split function since SVG className does not. if (typeof className.split == 'function' && goog.array.contains(className.split(' '), opt_class)) { arrayLike[len++] = el; } } arrayLike.length = len; return arrayLike; } What would be