Skip to content

Provide an example alternative for Array.forEach with index #216

Closed
@iansan5653

Description

@iansan5653

The documentation for the array-foreach rule provides an example of how to convert a forEach call to a for...of construction. However, that example doesn't show a best practice for accessing the array index, and this is not a problem with an obvious solution. For example, how can we convert the following to a for...of construction?

elements.forEach((element, index) => {...})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions