怎么编写JS的Array List  求高手解答

解决方案 »

  1.   

    http://www.wangchao.net.cn/bbsdetail_67452.html
      

  2.   

    var l=new ArrayList();
      l.add(1);
       l.add(2);
       l.add(3);
      

  3.   

    大姐  是在Java Script 里面写
      

  4.   

    我知道是在JavaScript里写,关键是你没有看清楚我的问题
      

  5.   

    JS的Array本来就是不定长度的数组....
    有必要写ArrayList吗?
      

  6.   

    简单的写了一个 <script type="text/javascript">        function ArrayList()
            {
                this._values = [];
            }        ArrayList.prototype.add = function(item)
            {
                this._values.push(item);
            }        ArrayList.prototype.getCount = function()
            {
                return this._values.length;
            }        ArrayList.prototype.getItem = function(index)
            {
                return this._values[index];
            }        var arrayList = new ArrayList();
            arrayList.add(1);
            arrayList.add(2);
            window.alert(arrayList.getCount());
            window.alert(arrayList.getItem(0));
            
        </script>