将HTMLCollection/NodeList/伪数组转换成数组
摘要:
这里把符合以下条件的对象称为伪数组(ArrayLike)1,具有length属性2,按索引方式存储数据3,不具有数组的push,pop等方法如1,function内的arguments 。2,通过document.forms,Form.elements,Select.options,document.getElementsByName() ,document.getElementsByTagName() ,childNodes/children等方式获取的集合(HTMLCollection,NodeList)等。3,特殊写法的对象 ,如?12345varobj={};obj[0] = &quo 阅读全文