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.

bug with: The globalTitle variable should not change.

See original GitHub issue

In the exercise, one of the condition is “The globalTitle variable should not change.” but it returns an error if you modified the var (for debugging) at the top, even if your function doesn’t mutate it. The verification should be that the initial globalTitle variable is the same as the final one, instead of simply looking to match it to a string.

// The global variable
var globalTitle = " Winter Is  Coming";

// Only change code below this line
function urlSlug(title) {
  return title
    .toLowerCase()
    .trim()
    .split(/\s+/)
    .join("-");
};
// Only change code above this line
console.log(globalTitle);
urlSlug(globalTitle);
console.log(globalTitle);

Add a Link to the page with the problem: Functional Programming: Apply Functional Programming to Convert Strings to URL Slugs

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
RandellDawsoncommented, Aug 2, 2020

I should not have used the word “mutable”. Looking at the challenge again, I think it would be fine to remove the global variable all together as it is not used in any other test (except the first). So, my suggestion is to remove the globalTitle declaration and remove the first test, unless someone else can find a good reason to keep them.

0reactions
naomi-lgbtcommented, Aug 2, 2020

By all means, go ahead! 🙂

As a note, issues labelled with the “help wanted” tag (like this one) don’t require permission before submitting a PR - I only made my earlier comment to ensure my interest didn’t deter other contributors.

Feel free to let me know if you have any questions!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Apply Functional Programming to Convert Strings to URL ...
Potential bug maybe? Code works great but still an error “the global variable should not change”. From my tests, it does NOT change…...
Read more >
The Problems with Global Variables - Embedded Artistry
When global data is used for a configuration value, mathematical constant, or other value that does not change at runtime, ensure: The variable...
Read more >
Re: st: RE: local variable within a global macro? - Stata
I must say, joining this list has been a good learning experience. ... (I would call them global macros and local macros but...
Read more >
is it possible to define global title on figures? - MATLAB Answers
Yes this is possible by creating a new axes which takes up much of the figure. Then a title for this axes. Turning...
Read more >
GemStone Bug Summary for Search December 2021 - Index of
Bug 47385 - Committed method changes may be lost if class option ... However, adding an instance variable does not copy the methods...
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