Array#push()
returns the new length of the array, most time return array.push(foo)
is a mistake.
function foo() {
return array.push(bar);
}
// If mean to return the length
function foo() {
return array.length + bar.length;
}
// If mean to push and exit
function foo() {
if (true) {
array.push(bar);
return;
}
// ...
}
// Have to use `eslint-disable`
function foo() {
// eslint-disable-next-line unicorn/no-return-array-push
return array.push(bar);
}
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too