示例#1
0
        public JSArray splice(long first, long len)
        {
            JSArray result = new JSArray(GLOBAL);

            if (first < 0)
            {
                first += length;
            }
            if (len < 0)
            {
                return(result);
            }
            if (first < 0)
            {
                first = 0;
            }
            long i = first, end = Math.Min(first + len, length);

            while (i < end)
            {
                result.push(this[i++].GetValue(GLOBAL));
            }
            while (i < length)
            {
                this[first++] = this[i++];
            }
            length = first;
            return(result);
        }
示例#2
0
        public static JSArray concat(ExecutionContext GLOBAL, params JSArray[] arrays)
        {
            JSArray newArray = new JSArray(GLOBAL);

            foreach (JSArray ja in arrays)
            {
                int i;
                for (i = 0; i < ja.length; i++)
                {
                    newArray.push(ja[i].GetValue(GLOBAL));
                }
            }
            return(newArray);
        }