文章出處

  var elems = {
        length: 0,
        add: function (elem) {
            Array.prototype.push.call(this, elem);
        },
        gather: function (id) {
            this.add(document.getElementById(id));
        }
    };
    elems.gather("first");
    console.log(elems.length == 1 && elems[0].id, "Verify that we have an element in our stash");
    elems.gather("second");
    console.assert(elems.length == 2 && elems[1].id, "Verify the other insertion");

 


文章列表




Avast logo

Avast 防毒軟體已檢查此封電子郵件的病毒。
www.avast.com


arrow
arrow
    全站熱搜
    創作者介紹
    創作者 大師兄 的頭像
    大師兄

    IT工程師數位筆記本

    大師兄 發表在 痞客邦 留言(0) 人氣()