question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Stacked Methods Do Not Pass with removeJSComments

See original GitHub issue

Challenge: https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array

Forum post: https://forum.freecodecamp.org/t/bug-found-in-this-challenge/458226

Is some part of the code processing chain causing this challenge to fail with the following code?

This fails

var filteredList = watchList.map(movie => ({
   title: movie["Title"],
   rating: movie["imdbRating"]
}))
.filter(r => {
  return parseFloat(r.rating) >= 8.0;
})

This passes:

var filteredList = watchList.map(movie => ({title: movie["Title"],rating: movie["imdbRating"]})).filter(r => {
  return parseFloat(r.rating) >= 8.0;
})

The match for .filter is failing. But it doesn’t seem to me like it should be the regex that is the issue assert(code.match(/\.filter/g)); so maybe we inadvertently broke something, somehow?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:19 (19 by maintainers)

github_iconTop GitHub Comments

2reactions
ShaunSHamiltoncommented, Jun 1, 2021

@Sembauke Thank you, for keeping up with this. I was a bit out of the loop with what was happening between this issue and the Safari issue. I will close this, once tested on .dev

1reaction
lasjorgcommented, May 31, 2021

@ShaunSHamilton This should get fixed with https://github.com/freeCodeCamp/freeCodeCamp/pull/42254 which is a comment removal implementation using our own fork of the strip-comments lib.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Does removing comments improve code performance? ...
Removing comments will make the Javascript file smaller and easier to download. Other than that, it will not affect noticably performance at all....
Read more >
Is there a method for differentiating informative comments ...
There is a very simple solution to this: remove the commented-out code. Really, there are only two good reasons to comment out code:...
Read more >
Best practices for writing code comments
While all of these points are true, it would be a mistake to go to the other extreme and never write comments. Here...
Read more >
Commenting Code in JavaScript - Types and Best Practices
Comments are notes written in the code that are ignored by the JavaScript engine, which means they don't affect the output in any...
Read more >
Blade Templates - Laravel - The PHP Framework For Web ...
The Blade templating is based on regular expressions and attempts to pass a complex expression to the directive may cause unexpected failures. The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found