-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Update removeAt function #1264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update removeAt function #1264
Conversation
Previous removeAt function would throw a type error if the index is equals to the length of the list. This is because the check at line 184 checked if the index is greater or equals to the length of the list whereas it should only check if the index is greater than the length and if true, it should throw a type error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can't be quite right either. It seems the code intended to use 0-based indexing. This would give us indices from 0 (first) to length - 1 (last), which is what the code correctly checks against. The later check index === this.length is presumably wrong however and should be fixed to be index === this.length - 1.
Also, please add tests.
Uh oh!
There was an error while loading. Please reload this page.
Previous removeAt function would throw a type error if the index is equals to the length of the list. This is because the first if statement in the removeAt function checked if the index is greater or equals to the length of the list whereas it should only check if the index is greater than the length and if true, it should throw a type error.
Open in Gitpod know more
Describe your change:
Checklist:
Example:
UserProfile.jsis allowed butuserprofile.js,Userprofile.js,user-Profile.js,userProfile.jsare notFixes: #{$ISSUE_NO}.