You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// ❌array.splice(-1,1,element);array.splice(array.length-1,1,element);// This can be ignored since `unicorn/prefer-negative-index` already fix it to the previous one.// ✅array[array.length-1]=element;
Note: the replacements in examples are not safe to fix, since they behavior differently when the index is out of boundary, even the -1 case, since the array can be empty.