bug with: The globalTitle variable should not change.
See original GitHub issueIn 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:
- Created 3 years ago
- Comments:13 (13 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.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!