Skip to content
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

Remove global flag from the regex in solution of No Repeats Please problem #36377

Closed
ar5had opened this issue Jul 4, 2019 · 3 comments · Fixed by #36380
Closed

Remove global flag from the regex in solution of No Repeats Please problem #36377

ar5had opened this issue Jul 4, 2019 · 3 comments · Fixed by #36380
Assignees

Comments

@ar5had
Copy link

ar5had commented Jul 4, 2019

Describe your problem and how to reproduce it:
The code solution uses global flag in regex, which should not be used unless you really want to use a global flag. The solution works fine, but it is prone to error. Try replacing match with RegExp.test and you ll see the issues that I am talking about.

See - why-does-a-regexp-with-global-flag-give-wrong-results and last baa word not getting filtered for more info.

Add a Link to the page with the problem:
https://guide.freecodecamp.org/certifications/coding-interview-prep/algorithms/no-repeats-please/

@ar5had
Copy link
Author

ar5had commented Jul 4, 2019

Also var permutations should be assigned an empty array instead of <a href='https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":rocket:"' target='_blank' rel='nofollow'>];

@RandellDawson
Copy link
Member

I will take care of this.

@RandellDawson
Copy link
Member

RandellDawson commented Jul 5, 2019

@arshdkhn1 I created the necessary pull request to fix the Guide. Once it is merged, we will still have to wait for the master branch to be deployed to the production site for you to see the change.

Thanks for pointing out this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants