The
entries()
method returns a new Array Iterator object that contains the key/value pairs for each index in the array.(c) MDN
🐊Putout plugin adds ability to remove useless array.entries()
.
npm i @putout/plugin-remove-useless-array-entries
{
"rules": {
"remove-useless-array-entries": "on"
}
}
for (const [, element] of array.entries()) {
console.log(element);
}
for (const element of array) {
console.log(element);
}
MIT