you are returning str, you need to return the output of replace, remember that strings are immutable, so str is the same as what was inputted to the function
you have written it on its own line to slowly build the expression, but until now you have done nothing with the value returned by replace, you need to return it. You return something in a function by writing return at the beginning of a line and to its right what you want to return
right, I hear you. could you give me an example? much easier to visually see what you are trying to explain. I have been working on this problem all afternoon and have researched different websites to help solve this challenge. I’ve seen how return is used, but there must be something i’m missing , which I can’t grasp through written text.
if you want to return 3 from a function, you write return 3 as its last line, if you want to return the value from a variable called output, you write return output as last line of the function, you want to return the value from replace
It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.
It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.
Great discussion! Took me awhile, but the key is in lesson ‘learn-basic-javascript-by-building-a-role-playing-game/step-147’ from the prior learning project.