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”?