Bug: uBlock Origin breaks certain javascript challenges
See original GitHub issueAffected page Various challenges in “Basic javascript” lessons. First fully-broken lesson I encountered: https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/return-early-pattern-for-functions Previous lessons gave same error, but were passable without disabling uBlock. Your code Copy and paste the code from the editor that you used in between the back-ticks below: Have uBlock Origin addon active and try correct solution for https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/return-early-pattern-for-functions Interestingly, I tried replicating the issue by re-enabling uBlock and trying the code again, and it passed subsequent times with uBlock enabled.
// Setup
function abTest(a, b) {
// Only change code below this line
if (a < 0 || b < 0) {
return undefined;
}
// Only change code above this line
return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));
}
abTest(2,2);
Expected behavior Add a clear and concise description of what you expected to happen. Correct solution passes test.
Screenshots If applicable, add screenshots to help explain your problem. you can drag and drop, png, jpg, gif, etc. in this box. Top banner error message that said something along the lines of " Something went wrong, a report has been filed for this issue"
System (please complete the following information):
- Device: [desktop]
- OS: [e.g. Windows 10]
- Browser: [Firefox, uBlock Origin addon]
- Version: [e.g. 22]
Additional context
Add any other context about the problem here.
Yeah, it appears uBlock is breaking something with javascript. My understanding is uBlock utilizes different injection methods to heuristically sanitize ad scripts.
However, re-enabling uBlock and running the test again with the same correct code passes the test.
Solution that has worked for me so far is just add freecodecamp.org to the allowlist.
Issue Analytics
- State:
- Created 2 years ago
- Comments:19 (18 by maintainers)
Top GitHub Comments
We are basically reintroducing https://github.com/freeCodeCamp/freeCodeCamp/pull/38806 which as an aside originally also tried to deal with ad/script blockers.
Might it not be better to add the warning to the top of the RWD start page instead of the section blocks?
It’s not just the Basic CSS section that has color challenges.
I get that the camper is automatically taken from the last HTML challenge to the first CSS challenge (which uses colors). So having a warning on this challenge might be necessary. But again this might be avoided simpely by having a warning at the begining of the RWD section.
Here it is with a bootstrap alert. But it can also just be a simple paragraph (note in bold, or all of it in bold).
Yes - see https://github.com/freeCodeCamp/freeCodeCamp/issues/41995#issuecomment-832707706