Learn Recursion by Building a Decimal to Binary Converter - Step 48

Tell us what’s happening:

Heads up for devs / anyone stuck on this problem:

Even though it says
“Note: Since the string you’re adding includes double quotation marks, wrap it in single quotation marks (') or backticks (`).”

It would not accept my solution with single quotes around the double quoted text. It did accept it with only the double quotes.

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36

Challenge Information:

Learn Recursion by Building a Decimal to Binary Converter - Step 48

I was not able to replicate the behavior you are describing.

1 Like

Hi @laserlemon

Are you refering to the string "a(): returns 'freeCodeCamp ' + b()"
or the string within the string - 'freeCodeCamp '?

Happy coding

1 Like

Apologies, I should’ve copied the full text for clarity. Here is what the user is given:

Step 48

When your code runs, the a() function is added to the call stack first.

In your callStack array, add the following string: "a(): returns 'freeCodeCamp ' + b()". This represents the function call and the code that will be executed.

Note: Since the string you’re adding includes double quotation marks, wrap it in single quotation marks (') or backticks (`).

As it is written, my understanding is that we need to add the given string, including the double quotes, to the array. In order to do that we need to add single quotes to the outside. Like this:

const callStack = [
'"a(): returns 'freeCodeCamp ' + b()"'
];
//This does not pass

However, this does not pass. I receive the error:

Sorry, your code does not pass. You're getting there.

`callStack` have a single element that is a string.

My code does pass when I remove the outer single quotes and copy / paste the string as written:

const callStack = [
"a(): returns 'freeCodeCamp ' + b()"
];
//This passes

(For completeness I also tried submitting the reversed case, with double quotes inside around the fcc text and single quotes on the outside, and that was accepted too)

I have just tried again, and it IS accepted if I use backticks (but not single quotes):

const callStack = [
`"a(): returns 'freeCodeCamp ' + b()"`
];
//This passes too

So it seems like the instruction text or the code that checks the answer could use an update, since the Note mentions using single quotes but using them does not create a passing condition for this step.

Also it seems like there may be missing text in the fail message. I do not know what “callStack have a single element that is a string.” means. Maybe missing a “should”?

1 Like

Good catch, seems like an issue that could be submitted on github.

If you’d like to do that yourself you can do it here: https://github.com/freeCodeCamp/freeCodeCamp/issues

You can look at a few existing issues to see the process and your description of the problem here is good. Just need to be clear.

Otherwise I’ve bookmarked this and will do it later.

1 Like

Thank you. I have just submitted it on GitHub.

1 Like