神岛 API 文档 - ArenaPro版
    Preparing search index...

    Interface RegExpExecArray

    表示正则表达式执行结果的数组。

    Represents an array of results from a regular expression execution.

    interface RegExpExecArray {
        "[unscopables]": {
            "[iterator]"?: boolean;
            "[unscopables]"?: boolean;
            concat?: boolean;
            copyWithin?: boolean;
            entries?: boolean;
            every?: boolean;
            fill?: boolean;
            filter?: boolean;
            find?: boolean;
            findIndex?: boolean;
            flat?: boolean;
            flatMap?: boolean;
            forEach?: boolean;
            includes?: boolean;
            indexOf?: boolean;
            join?: boolean;
            keys?: boolean;
            lastIndexOf?: boolean;
            length?: boolean;
            map?: boolean;
            pop?: boolean;
            push?: boolean;
            reduce?: boolean;
            reduceRight?: boolean;
            reverse?: boolean;
            shift?: boolean;
            slice?: boolean;
            some?: boolean;
            sort?: boolean;
            splice?: boolean;
            toLocaleString?: boolean;
            toString?: boolean;
            unshift?: boolean;
            values?: boolean;
            [key: number]: boolean;
        };
        groups?: { [key: string]: string };
        index: number;
        input: string;
        length: number;
        "[iterator]"(): ArrayIterator<string>;
        "[iterator]"(): IterableIterator<string>;
        concat(...items: ConcatArray<string>[]): string[];
        concat(...items: (string | ConcatArray<string>)[]): string[];
        concat(...items: ConcatArray<string>[]): string[];
        concat(...items: (string | ConcatArray<string>)[]): string[];
        copyWithin(target: number, start: number, end?: number): this;
        copyWithin(target: number, start: number, end?: number): this;
        entries(): ArrayIterator<[number, string]>;
        entries(): IterableIterator<[number, string]>;
        every<S extends string>(
            predicate: (
                value: string,
                index: number,
                array: string[],
            ) => value is S,
            thisArg?: any,
        ): this is S[];
        every(
            predicate: (value: string, index: number, array: string[]) => unknown,
            thisArg?: any,
        ): boolean;
        every(
            callbackfn: (value: string, index: number, array: string[]) => unknown,
            thisArg?: any,
        ): boolean;
        fill(value: string, start?: number, end?: number): this;
        fill(value: string, start?: number, end?: number): this;
        filter<S extends string>(
            predicate: (
                value: string,
                index: number,
                array: string[],
            ) => value is S,
            thisArg?: any,
        ): S[];
        filter(
            predicate: (value: string, index: number, array: string[]) => unknown,
            thisArg?: any,
        ): string[];
        filter<S extends string>(
            callbackfn: (
                value: string,
                index: number,
                array: string[],
            ) => value is S,
            thisArg?: any,
        ): S[];
        filter(
            callbackfn: (value: string, index: number, array: string[]) => unknown,
            thisArg?: any,
        ): string[];
        find<S extends string>(
            predicate: (value: string, index: number, obj: string[]) => value is S,
            thisArg?: any,
        ): S;
        find<S extends string>(
            predicate: (
                this: void,
                value: string,
                index: number,
                obj: string[],
            ) => value is S,
            thisArg?: any,
        ): S;
        find(
            predicate: (value: string, index: number, obj: string[]) => unknown,
            thisArg?: any,
        ): string;
        findIndex(
            predicate: (value: string, index: number, obj: string[]) => unknown,
            thisArg?: any,
        ): number;
        findIndex(
            predicate: (value: string, index: number, obj: string[]) => unknown,
            thisArg?: any,
        ): number;
        flat<A, D extends number = 1>(this: A, depth?: D): FlatArray<A, D>[];
        flat<U>(this: U[][][][][][][][], depth: 7): U[];
        flat<U>(this: U[][][][][][][], depth: 6): U[];
        flat<U>(this: U[][][][][][], depth: 5): U[];
        flat<U>(this: U[][][][][], depth: 4): U[];
        flat<U>(this: U[][][][], depth: 3): U[];
        flat<U>(this: U[][][], depth: 2): U[];
        flat<U>(this: U[][], depth?: 1): U[];
        flat<U>(this: U[], depth: 0): U[];
        flat<U>(depth?: number): any[];
        flatMap<U, This = undefined>(
            callback: (
                this: This,
                value: string,
                index: number,
                array: string[],
            ) => U | readonly U[],
            thisArg?: This,
        ): U[];
        flatMap<U, This = undefined>(
            callback: (
                this: This,
                value: string,
                index: number,
                array: string[],
            ) => U | readonly U[],
            thisArg?: This,
        ): U[];
        forEach(
            callbackfn: (value: string, index: number, array: string[]) => void,
            thisArg?: any,
        ): void;
        forEach(
            callbackfn: (value: string, index: number, array: string[]) => void,
            thisArg?: any,
        ): void;
        includes(searchElement: string, fromIndex?: number): boolean;
        includes(searchElement: string, fromIndex?: number): boolean;
        indexOf(searchElement: string, fromIndex?: number): number;
        indexOf(searchElement: string, fromIndex?: number): number;
        join(separator?: string): string;
        join(separator?: string): string;
        keys(): ArrayIterator<number>;
        keys(): IterableIterator<number>;
        lastIndexOf(searchElement: string, fromIndex?: number): number;
        lastIndexOf(searchElement: string, fromIndex?: number): number;
        map<U>(
            callbackfn: (value: string, index: number, array: string[]) => U,
            thisArg?: any,
        ): U[];
        map<U>(
            callbackfn: (value: string, index: number, array: string[]) => U,
            thisArg?: any,
        ): U[];
        pop(): string;
        pop(): string;
        push(...items: string[]): number;
        push(...items: string[]): number;
        reduce(
            callbackfn: (
                previousValue: string,
                currentValue: string,
                currentIndex: number,
                array: string[],
            ) => string,
        ): string;
        reduce<U>(
            callbackfn: (
                previousValue: U,
                currentValue: string,
                currentIndex: number,
                array: string[],
            ) => U,
            initialValue: U,
        ): U;
        reduce(
            callbackfn: (
                previousValue: string,
                currentValue: string,
                currentIndex: number,
                array: string[],
            ) => string,
        ): string;
        reduce<U>(
            callbackfn: (
                previousValue: U,
                currentValue: string,
                currentIndex: number,
                array: string[],
            ) => U,
            initialValue: U,
        ): U;
        reduceRight(
            callbackfn: (
                previousValue: string,
                currentValue: string,
                currentIndex: number,
                array: string[],
            ) => string,
        ): string;
        reduceRight<U>(
            callbackfn: (
                previousValue: U,
                currentValue: string,
                currentIndex: number,
                array: string[],
            ) => U,
            initialValue: U,
        ): U;
        reduceRight(
            callbackfn: (
                previousValue: string,
                currentValue: string,
                currentIndex: number,
                array: string[],
            ) => string,
        ): string;
        reduceRight<U>(
            callbackfn: (
                previousValue: U,
                currentValue: string,
                currentIndex: number,
                array: string[],
            ) => U,
            initialValue: U,
        ): U;
        reverse(): string[];
        reverse(): string[];
        shift(): string;
        shift(): string;
        slice(start?: number, end?: number): string[];
        slice(start?: number, end?: number): string[];
        some(
            predicate: (value: string, index: number, array: string[]) => unknown,
            thisArg?: any,
        ): boolean;
        some(
            callbackfn: (value: string, index: number, array: string[]) => unknown,
            thisArg?: any,
        ): boolean;
        sort(compareFn?: (a: string, b: string) => number): this;
        sort(compareFn?: (a: string, b: string) => number): this;
        splice(start: number, deleteCount?: number): string[];
        splice(start: number, deleteCount: number, ...items: string[]): string[];
        splice(start: number, deleteCount?: number): string[];
        splice(start: number, deleteCount: number, ...items: string[]): string[];
        toLocaleString(): string;
        toLocaleString(): string;
        toString(): string;
        toString(): string;
        unshift(...items: string[]): number;
        unshift(...items: string[]): number;
        values(): ArrayIterator<string>;
        values(): IterableIterator<string>;
    }
    Index

    Properties

    "[unscopables]": {
        "[iterator]"?: boolean;
        "[unscopables]"?: boolean;
        concat?: boolean;
        copyWithin?: boolean;
        entries?: boolean;
        every?: boolean;
        fill?: boolean;
        filter?: boolean;
        find?: boolean;
        findIndex?: boolean;
        flat?: boolean;
        flatMap?: boolean;
        forEach?: boolean;
        includes?: boolean;
        indexOf?: boolean;
        join?: boolean;
        keys?: boolean;
        lastIndexOf?: boolean;
        length?: boolean;
        map?: boolean;
        pop?: boolean;
        push?: boolean;
        reduce?: boolean;
        reduceRight?: boolean;
        reverse?: boolean;
        shift?: boolean;
        slice?: boolean;
        some?: boolean;
        sort?: boolean;
        splice?: boolean;
        toLocaleString?: boolean;
        toString?: boolean;
        unshift?: boolean;
        values?: boolean;
        [key: number]: boolean;
    }

    Is an object whose properties have the value 'true' when they will be absent when used in a 'with' statement.

    Type declaration

    • [key: number]: boolean
    • Optional[iterator]?: boolean
    • Optional Readonly[unscopables]?: boolean

      Is an object whose properties have the value 'true' when they will be absent when used in a 'with' statement.

    • Optionalconcat?: boolean
    • OptionalcopyWithin?: boolean
    • Optionalentries?: boolean
    • Optionalevery?: boolean
    • Optionalfill?: boolean
    • Optionalfilter?: boolean
    • Optionalfind?: boolean
    • OptionalfindIndex?: boolean
    • Optionalflat?: boolean
    • OptionalflatMap?: boolean
    • OptionalforEach?: boolean
    • Optionalincludes?: boolean
    • OptionalindexOf?: boolean
    • Optionaljoin?: boolean
    • Optionalkeys?: boolean
    • OptionallastIndexOf?: boolean
    • Optionallength?: boolean

      Gets or sets the length of the array. This is a number one higher than the highest index in the array.

    • Optionalmap?: boolean
    • Optionalpop?: boolean
    • Optionalpush?: boolean
    • Optionalreduce?: boolean
    • OptionalreduceRight?: boolean
    • Optionalreverse?: boolean
    • Optionalshift?: boolean
    • Optionalslice?: boolean
    • Optionalsome?: boolean
    • Optionalsort?: boolean
    • Optionalsplice?: boolean
    • OptionaltoLocaleString?: boolean
    • OptionaltoString?: boolean
    • Optionalunshift?: boolean
    • Optionalvalues?: boolean
    groups?: { [key: string]: string }

    一个包含命名捕获组的对象,或者如果未使用命名捕获组,则为 undefined。

    An object containing named capture groups, or undefined if no named capture groups were used.

    index: number

    The index of the search at which the result was found.

    input: string

    A copy of the search string.

    length: number

    Gets or sets the length of the array. This is a number one higher than the highest index in the array.

    Methods

    • Iterator

      Returns ArrayIterator<string>

    • Returns IterableIterator<string>

      迭代器

      Iterator

    • Combines two or more arrays. This method returns a new array without modifying any existing arrays.

      Parameters

      • ...items: ConcatArray<string>[]

        Additional arrays and/or items to add to the end of the array.

      Returns string[]

    • Combines two or more arrays. This method returns a new array without modifying any existing arrays.

      Parameters

      • ...items: (string | ConcatArray<string>)[]

        Additional arrays and/or items to add to the end of the array.

      Returns string[]

    • Parameters

      • ...items: ConcatArray<string>[]

      Returns string[]

      合并两个或多个数组。

      Combines two or more arrays.

      要添加到 array1 末尾的其他项。

      Additional items to add to the end of array1.

    • Parameters

      • ...items: (string | ConcatArray<string>)[]

      Returns string[]

      合并两个或多个数组。

      Combines two or more arrays.

      要添加到 array1 末尾的其他项。

      Additional items to add to the end of array1.

    • Returns the this object after copying a section of the array identified by start and end to the same array starting at position target

      Parameters

      • target: number

        If target is negative, it is treated as length+target where length is the length of the array.

      • start: number

        If start is negative, it is treated as length+start. If end is negative, it is treated as length+end.

      • Optionalend: number

        If not specified, length of the this object is used as its default value.

      Returns this

    • Parameters

      • target: number
      • start: number
      • Optionalend: number

      Returns this

      浅复制数组的一部分到同一数组中的另一个位置,并返回它,不会改变原数组的长度。

      Returns the this object after copying a section of the array identified by start and end to the same array starting at position target

      复制序列到该位置。如果为负数,target 将从末尾开始计算。

      If target is negative, it is treated as length+target where length is the length of the array.

      开始复制元素的起始位置。如果为负数,start 将从末尾开始计算。

      If start is negative, it is treated as length+start. If end is negative, it is treated as length+end.

      停止复制元素的终止位置。如果未指定,copyWithin 将会一直复制到数组末尾。

      If not specified, length of the this object is used as its default value.

    • Returns an iterable of key, value pairs for every entry in the array

      Returns ArrayIterator<[number, string]>

    • Returns IterableIterator<[number, string]>

      返回一个新的Array Iterator对象,该对象包含数组中每个索引的键/值对。

      Returns an iterable of key, value pairs for every entry in the array

    • Determines whether all the members of an array satisfy the specified test.

      Type Parameters

      • S extends string

      Parameters

      • predicate: (value: string, index: number, array: string[]) => value is S

        A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

      • OptionalthisArg: any

        An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

      Returns this is S[]

    • Determines whether all the members of an array satisfy the specified test.

      Parameters

      • predicate: (value: string, index: number, array: string[]) => unknown

        A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

      • OptionalthisArg: any

        An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

      Returns boolean

    • Parameters

      • callbackfn: (value: string, index: number, array: string[]) => unknown
      • OptionalthisArg: any

      Returns boolean

      判断数组的所有成员是否满足指定测试。

      Determines whether all the members of an array satisfy the specified test.

      一个最多接受三个参数的函数。every 方法为数组中的每个元素调用 callbackfn 函数,直到 callbackfn 返回一个可强制转换为布尔值 false 的值,或者直到数组的末尾。

      A function that accepts up to three arguments. The every method calls the callbackfn function for each element in the array until the callbackfn returns a value which is coercible to the Boolean value false, or until the end of the array.

      一个对象,this 关键字可以在 callbackfn 函数中引用该对象。如果省略 thisArg,则 undefined 将用作 this 值。

      An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

    • Changes all array elements from start to end index to a static value and returns the modified array

      Parameters

      • value: string

        value to fill array section with

      • Optionalstart: number

        index to start filling the array at. If start is negative, it is treated as length+start where length is the length of the array.

      • Optionalend: number

        index to stop filling the array at. If end is negative, it is treated as length+end.

      Returns this

    • Parameters

      • value: string
      • Optionalstart: number
      • Optionalend: number

      Returns this

      用一个固定值填充一个数组中从起始索引到终止索引内的全部元素。

      Returns the this object after filling the section identified by start and end with value

      用来填充数组的值。

      value to fill array section with

      起始索引,默认为0。

      index to start filling the array at. If start is negative, it is treated as length+start where length is the length of the array.

      终止索引,默认为 a.length。

      index to stop filling the array at. If end is negative, it is treated as length+end.

    • Returns the elements of an array that meet the condition specified in a callback function.

      Type Parameters

      • S extends string

      Parameters

      • predicate: (value: string, index: number, array: string[]) => value is S

        A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

      • OptionalthisArg: any

        An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

      Returns S[]

    • Returns the elements of an array that meet the condition specified in a callback function.

      Parameters

      • predicate: (value: string, index: number, array: string[]) => unknown

        A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

      • OptionalthisArg: any

        An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

      Returns string[]

    • Type Parameters

      • S extends string

      Parameters

      • callbackfn: (value: string, index: number, array: string[]) => value is S
      • OptionalthisArg: any

      Returns S[]

      返回数组中满足回调函数中指定条件的元素。

      Returns the elements of an array that meet the condition specified in a callback function.

      一个最多接受三个参数的函数。filter 方法为数组中的每个元素调用一次 callbackfn 函数。

      A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.

      一个对象,this 关键字可以在 callbackfn 函数中引用该对象。如果省略 thisArg,则 undefined 将用作 this 值。

      An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

    • Parameters

      • callbackfn: (value: string, index: number, array: string[]) => unknown
      • OptionalthisArg: any

      Returns string[]

      返回数组中满足回调函数中指定条件的元素。

      Returns the elements of an array that meet the condition specified in a callback function.

      一个最多接受三个参数的函数。filter 方法为数组中的每个元素调用一次 callbackfn 函数。

      A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.

      一个对象,this 关键字可以在 callbackfn 函数中引用该对象。如果省略 thisArg,则 undefined 将用作 this 值。

      An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

    • Returns the value of the first element in the array where predicate is true, and undefined otherwise.

      Type Parameters

      • S extends string

      Parameters

      • predicate: (value: string, index: number, obj: string[]) => value is S

        find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.

      • OptionalthisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

      Returns S

    • Type Parameters

      • S extends string

      Parameters

      • predicate: (this: void, value: string, index: number, obj: string[]) => value is S
      • OptionalthisArg: any

      Returns S

      返回数组中满足提供的测试函数的第一个元素的值。否则返回 undefined。

      Returns the value of the first element in the array where predicate is true, and undefined otherwise.

      为数组中的每个元素执行的函数。

      find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.

      执行 predicate 时用作 this 的对象。

      If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

    • Parameters

      • predicate: (value: string, index: number, obj: string[]) => unknown
      • OptionalthisArg: any

      Returns string

      返回数组中满足提供的测试函数的第一个元素的值。否则返回 undefined。

      Returns the value of the first element in the array where predicate is true, and undefined otherwise.

      为数组中的每个元素执行的函数。

      find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.

      执行 predicate 时用作 this 的对象。

      If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

    • Returns the index of the first element in the array where predicate is true, and -1 otherwise.

      Parameters

      • predicate: (value: string, index: number, obj: string[]) => unknown

        find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1.

      • OptionalthisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

      Returns number

    • Parameters

      • predicate: (value: string, index: number, obj: string[]) => unknown
      • OptionalthisArg: any

      Returns number

      返回数组中满足提供的测试函数的第一个元素的索引。若没有找到对应元素则返回-1。

      Returns the index of the first element in the array where predicate is true, and -1 otherwise.

      为数组中的每个元素执行的函数。

      find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1.

      执行 predicate 时用作 this 的对象。

      If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

    • Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

      Type Parameters

      • A
      • D extends number = 1

      Parameters

      • this: A
      • Optionaldepth: D

        The maximum recursion depth

      Returns FlatArray<A, D>[]

    • Type Parameters

      • U

      Parameters

      • this: U[][][][][][][][]
      • depth: 7

      Returns U[]

      返回一个新数组,其中所有子数组元素递归地连接到指定深度。

      Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

      最大递归深度。

      The maximum recursion depth.

    • Type Parameters

      • U

      Parameters

      • this: U[][][][][][][]
      • depth: 6

      Returns U[]

      返回一个新数组,其中所有子数组元素递归地连接到指定深度。

      Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

      最大递归深度。

      The maximum recursion depth.

    • Type Parameters

      • U

      Parameters

      • this: U[][][][][][]
      • depth: 5

      Returns U[]

      返回一个新数组,其中所有子数组元素递归地连接到指定深度。

      Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

      最大递归深度。

      The maximum recursion depth.

    • Type Parameters

      • U

      Parameters

      • this: U[][][][][]
      • depth: 4

      Returns U[]

      返回一个新数组,其中所有子数组元素递归地连接到指定深度。

      Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

      最大递归深度。

      The maximum recursion depth.

    • Type Parameters

      • U

      Parameters

      • this: U[][][][]
      • depth: 3

      Returns U[]

      返回一个新数组,其中所有子数组元素递归地连接到指定深度。

      Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

      最大递归深度。

      The maximum recursion depth.

    • Type Parameters

      • U

      Parameters

      • this: U[][][]
      • depth: 2

      Returns U[]

      返回一个新数组,其中所有子数组元素递归地连接到指定深度。

      Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

      最大递归深度。

      The maximum recursion depth.

    • Type Parameters

      • U

      Parameters

      • this: U[][]
      • Optionaldepth: 1

      Returns U[]

      返回一个新数组,其中所有子数组元素递归地连接到指定深度。

      Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

      最大递归深度。

      The maximum recursion depth.

    • Type Parameters

      • U

      Parameters

      • this: U[]
      • depth: 0

      Returns U[]

      返回一个新数组,其中所有子数组元素递归地连接到指定深度。

      Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

      最大递归深度。

      The maximum recursion depth.

    • Type Parameters

      • U

      Parameters

      • Optionaldepth: number

      Returns any[]

      返回一个新数组,其中所有子数组元素递归地连接到指定深度。如果未提供深度,flat 方法默认为深度 1。

      Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth. If no depth is provided, flat method defaults to the depth of 1.

      最大递归深度。

      The maximum recursion depth.

    • Calls a defined callback function on each element of an array. Then, flattens the result into a new array. This is identical to a map followed by flat with depth 1.

      Type Parameters

      • U
      • This = undefined

      Parameters

      • callback: (this: This, value: string, index: number, array: string[]) => U | readonly U[]

        A function that accepts up to three arguments. The flatMap method calls the callback function one time for each element in the array.

      • OptionalthisArg: This

        An object to which the this keyword can refer in the callback function. If thisArg is omitted, undefined is used as the this value.

      Returns U[]

    • Type Parameters

      • U
      • This = undefined

      Parameters

      • callback: (this: This, value: string, index: number, array: string[]) => U | readonly U[]
      • OptionalthisArg: This

      Returns U[]

      对数组中的每个元素调用定义的回调函数,然后将结果展平为新数组。 这等同于先进行 map 操作,然后进行深度为 1 的 flat 操作。

      Calls a defined callback function on each element of an array. Then, flattens the result into a new array. This is identical to a map followed by flat with depth 1.

      一个接受最多三个参数的函数。flatMap 方法对数组中的每个元素调用一次回调函数。

      A function that accepts up to three arguments. The flatMap method calls the callback function one time for each element in the array.

      一个对象,在回调函数中可以作为 this 关键字引用。如果省略 thisArg,则使用 undefined 作为 this 值。

      An object to which the this keyword can refer in the callback function. If thisArg is omitted, undefined is used as the this value.

    • Performs the specified action for each element in an array.

      Parameters

      • callbackfn: (value: string, index: number, array: string[]) => void

        A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

      • OptionalthisArg: any

        An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

      Returns void

    • Parameters

      • callbackfn: (value: string, index: number, array: string[]) => void
      • OptionalthisArg: any

      Returns void

      对数组中的每个元素执行指定的操作。

      Performs the specified action for each element in an array.

      一个最多接受三个参数的函数。forEach 为数组中的每个元素调用一次 callbackfn 函数。

      A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

      一个对象,this 关键字可以在 callbackfn 函数中引用该对象。如果省略 thisArg,则 undefined 将用作 this 值。

      An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

    • Determines whether an array includes a certain element, returning true or false as appropriate.

      Parameters

      • searchElement: string

        The element to search for.

      • OptionalfromIndex: number

        The position in this array at which to begin searching for searchElement.

      Returns boolean

    • Parameters

      • searchElement: string
      • OptionalfromIndex: number

      Returns boolean

      判断一个数组是否包含一个指定的值,根据情况返回 true 或 false。

      Determines whether an array includes a certain element, returning true or false as appropriate.

      需要查找的元素值。

      The element to search for.

      从该索引处开始查找 searchElement。如果为负值,则按升序从 array.length + fromIndex 的索引开始搜索。

      The position in this array at which to begin searching for searchElement.

    • Returns the index of the first occurrence of a value in an array, or -1 if it is not present.

      Parameters

      • searchElement: string

        The value to locate in the array.

      • OptionalfromIndex: number

        The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.

      Returns number

    • Parameters

      • searchElement: string
      • OptionalfromIndex: number

      Returns number

      返回数组中某个值的第一次出现的索引。

      Returns the index of the first occurrence of a value in an array.

      要在数组中定位的值。

      The value to locate in the array.

      开始搜索的数组索引。如果省略 fromIndex,则搜索从索引 0 开始。

      The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.

    • Adds all the elements of an array into a string, separated by the specified separator string.

      Parameters

      • Optionalseparator: string

        A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

      Returns string

    • Parameters

      • Optionalseparator: string

      Returns string

      将数组的所有元素连接成一个字符串,并由指定的分隔符字符串分隔。

      Adds all the elements of an array separated by the specified separator string.

      用于分隔数组中一个元素与下一个元素的字符串。如果省略,数组元素用逗号分隔。

      A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.

    • Returns an iterable of keys in the array

      Returns ArrayIterator<number>

    • Returns IterableIterator<number>

      返回一个新的Array迭代器,它包含数组中每个索引的键。

      Returns an iterable of keys in the array

    • Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present.

      Parameters

      • searchElement: string

        The value to locate in the array.

      • OptionalfromIndex: number

        The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array.

      Returns number

    • Parameters

      • searchElement: string
      • OptionalfromIndex: number

      Returns number

      返回数组中指定值的最后一次出现的索引。

      Returns the index of the last occurrence of a specified value in an array.

      要在数组中定位的值。

      The value to locate in the array.

      开始搜索的数组索引。如果省略 fromIndex,则搜索从数组的最后一个索引开始。

      The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.

    • Calls a defined callback function on each element of an array, and returns an array that contains the results.

      Type Parameters

      • U

      Parameters

      • callbackfn: (value: string, index: number, array: string[]) => U

        A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

      • OptionalthisArg: any

        An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

      Returns U[]

    • Type Parameters

      • U

      Parameters

      • callbackfn: (value: string, index: number, array: string[]) => U
      • OptionalthisArg: any

      Returns U[]

      对数组的每个元素调用已定义的回调函数,并返回包含结果的数组。

      Calls a defined callback function on each element of an array, and returns an array that contains the results.

      一个最多接受三个参数的函数。map 方法为数组中的每个元素调用一次 callbackfn 函数。

      A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

      一个对象,this 关键字可以在 callbackfn 函数中引用该对象。如果省略 thisArg,则 undefined 将用作 this 值。

      An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

    • Removes the last element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.

      Returns string

    • Returns string

      从数组中移除最后一个元素并返回它。

      Removes the last element from an array and returns it.

    • Appends new elements to the end of an array, and returns the new length of the array.

      Parameters

      • ...items: string[]

        New elements to add to the array.

      Returns number

    • Parameters

      • ...items: string[]

      Returns number

      向数组追加新元素,并返回数组的新长度。

      Appends new elements to an array, and returns the new length of the array.

      数组的新元素。

      New elements of the Array.

    • Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

      Parameters

      • callbackfn: (
            previousValue: string,
            currentValue: string,
            currentIndex: number,
            array: string[],
        ) => string

        A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

      Returns string

    • Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

      Type Parameters

      • U

      Parameters

      • callbackfn: (
            previousValue: U,
            currentValue: string,
            currentIndex: number,
            array: string[],
        ) => U

        A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

      • initialValue: U

        If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

      Returns U

    • Parameters

      • callbackfn: (
            previousValue: string,
            currentValue: string,
            currentIndex: number,
            array: string[],
        ) => string

      Returns string

      为数组中的所有元素调用指定的回调函数。回调函数的返回值是累积的结果,并在下一次调用回调函数时作为参数提供。

      Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

      一个最多接受四个参数的函数。reduce 方法为数组中的每个元素调用一次 callbackfn 函数。

      A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

      如果指定了 initialValue,则将其用作开始累积的初始值。对 callbackfn 函数的第一次调用将此值作为参数而不是数组值提供。

      If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

    • Type Parameters

      • U

      Parameters

      • callbackfn: (
            previousValue: U,
            currentValue: string,
            currentIndex: number,
            array: string[],
        ) => U
      • initialValue: U

      Returns U

      为数组中的所有元素调用指定的回调函数。回调函数的返回值是累积的结果,并在下一次调用回调函数时作为参数提供。

      Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

      一个最多接受四个参数的函数。reduce 方法为数组中的每个元素调用一次 callbackfn 函数。

      A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

      如果指定了 initialValue,则将其用作开始累积的初始值。对 callbackfn 函数的第一次调用将此值作为参数而不是数组值提供。

      If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

    • Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

      Parameters

      • callbackfn: (
            previousValue: string,
            currentValue: string,
            currentIndex: number,
            array: string[],
        ) => string

        A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

      Returns string

    • Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

      Type Parameters

      • U

      Parameters

      • callbackfn: (
            previousValue: U,
            currentValue: string,
            currentIndex: number,
            array: string[],
        ) => U

        A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

      • initialValue: U

        If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

      Returns U

    • Parameters

      • callbackfn: (
            previousValue: string,
            currentValue: string,
            currentIndex: number,
            array: string[],
        ) => string

      Returns string

      按降序为数组中的所有元素调用指定的回调函数。回调函数的返回值是累积的结果,并在下一次调用回调函数时作为参数提供。

      Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

      一个最多接受四个参数的函数。reduceRight 方法为数组中的每个元素调用一次 callbackfn 函数。

      A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

      如果指定了 initialValue,则将其用作开始累积的初始值。对 callbackfn 函数的第一次调用将此值作为参数而不是数组值提供。

      If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

    • Type Parameters

      • U

      Parameters

      • callbackfn: (
            previousValue: U,
            currentValue: string,
            currentIndex: number,
            array: string[],
        ) => U
      • initialValue: U

      Returns U

      按降序为数组中的所有元素调用指定的回调函数。回调函数的返回值是累积的结果,并在下一次调用回调函数时作为参数提供。

      Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

      一个最多接受四个参数的函数。reduceRight 方法为数组中的每个元素调用一次 callbackfn 函数。

      A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

      如果指定了 initialValue,则将其用作开始累积的初始值。对 callbackfn 函数的第一次调用将此值作为参数而不是数组值提供。

      If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

    • Reverses the elements in an array in place. This method mutates the array and returns a reference to the same array.

      Returns string[]

    • Returns string[]

      反转数组中元素的顺序。

      Reverses the elements in an Array.

    • Removes the first element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.

      Returns string

    • Returns string

      从数组中移除第一个元素并返回它。

      Removes the first element from an array and returns it.

    • Returns a copy of a section of an array. For both start and end, a negative index can be used to indicate an offset from the end of the array. For example, -2 refers to the second to last element of the array.

      Parameters

      • Optionalstart: number

        The beginning index of the specified portion of the array. If start is undefined, then the slice begins at index 0.

      • Optionalend: number

        The end index of the specified portion of the array. This is exclusive of the element at the index 'end'. If end is undefined, then the slice extends to the end of the array.

      Returns string[]

    • Parameters

      • Optionalstart: number
      • Optionalend: number

      Returns string[]

      返回数组的一部分。

      Returns a section of an array.

      指定部分数组的开头。

      The beginning of the specified portion of the array.

      指定部分数组的结尾。这是索引“end”处元素的独占。

      The end of the specified portion of the array. This is exclusive of the element at the index 'end'.

    • Determines whether the specified callback function returns true for any element of an array.

      Parameters

      • predicate: (value: string, index: number, array: string[]) => unknown

        A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array.

      • OptionalthisArg: any

        An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

      Returns boolean

    • Parameters

      • callbackfn: (value: string, index: number, array: string[]) => unknown
      • OptionalthisArg: any

      Returns boolean

      确定指定的回调函数是否对数组的任何元素返回 true。

      Determines whether the specified callback function returns true for any element of an array.

      一个最多接受三个参数的函数。some 方法为数组中的每个元素调用 callbackfn 函数,直到 callbackfn 返回一个可强制转换为布尔值 true 的值,或者直到数组的末尾。

      A function that accepts up to three arguments. The some method calls the callbackfn function for each element in the array until the callbackfn returns a value which is coercible to the Boolean value true, or until the end of the array.

      一个对象,this 关键字可以在 callbackfn 函数中引用该对象。如果省略 thisArg,则 undefined 将用作 this 值。

      An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

    • Sorts an array in place. This method mutates the array and returns a reference to the same array.

      Parameters

      • OptionalcompareFn: (a: string, b: string) => number

        Function used to determine the order of the elements. It is expected to return a negative value if the first argument is less than the second argument, zero if they're equal, and a positive value otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order.

        [11,2,22,1].sort((a, b) => a - b)
        

      Returns this

    • Parameters

      • OptionalcompareFn: (a: string, b: string) => number

      Returns this

      对数组进行排序。

      Sorts an array.

      用于确定元素顺序的函数。如果第一个参数小于第二个参数,则应返回负值;如果相等,则返回零;否则返回正值。如果省略,则按升序 ASCII 字符顺序对元素进行排序。

      Function used to determine the order of the elements. It is expected to return a negative value if first argument is less than second argument, zero if they're equal and a positive value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.

      [11,2,22,1].sort((a, b) => a - b)
      
    • Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.

      Parameters

      • start: number

        The zero-based location in the array from which to start removing elements.

      • OptionaldeleteCount: number

        The number of elements to remove.

      Returns string[]

      An array containing the elements that were deleted.

    • Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.

      Parameters

      • start: number

        The zero-based location in the array from which to start removing elements.

      • deleteCount: number

        The number of elements to remove.

      • ...items: string[]

        Elements to insert into the array in place of the deleted elements.

      Returns string[]

      An array containing the elements that were deleted.

    • Parameters

      • start: number
      • OptionaldeleteCount: number

      Returns string[]

      从数组中删除元素,并在必要时在其位置插入新元素,返回已删除的元素。

      Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.

      数组中开始删除元素的从零开始的位置。

      The zero-based location in the array from which to start removing elements.

      要删除的元素数。

      The number of elements to remove.

    • Parameters

      • start: number
      • deleteCount: number
      • ...items: string[]

      Returns string[]

      从数组中删除元素,并在必要时在其位置插入新元素,返回已删除的元素。

      Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.

      数组中开始删除元素的从零开始的位置。

      The zero-based location in the array from which to start removing elements.

      要删除的元素数。

      The number of elements to remove.

      要插入到数组中代替已删除元素的元素。

      Elements to insert into the array in place of the deleted elements.

    • Returns a string representation of an array. The elements are converted to string using their toLocaleString methods.

      Returns string

    • Returns string

      返回数组的字符串表示形式。元素使用其 toLocaleString 方法转换为字符串。

      Returns a string representation of an array. The elements are converted to string using their toLocaleString methods.

    • Returns a string representation of an array.

      Returns string

    • Returns string

      返回数组的字符串表示形式。

      Returns a string representation of an array.

    • Inserts new elements at the start of an array, and returns the new length of the array.

      Parameters

      • ...items: string[]

        Elements to insert at the start of the array.

      Returns number

    • Parameters

      • ...items: string[]

      Returns number

      在数组的开头插入新元素。

      Inserts new elements at the start of an array.

      要在数组开头插入的元素。

      Elements to insert at the start of the Array.

    • Returns an iterable of values in the array

      Returns ArrayIterator<string>

    • Returns IterableIterator<string>

      返回一个新的Array Iterator对象,该对象包含数组中每个索引的值。

      Returns an iterable of values in the array