-
-
Notifications
You must be signed in to change notification settings - Fork 951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggested solution for two-fer doesn't pass tests. #918
Comments
Default values always work. Your test suite is likely outdated (and it's passing in '' instead of "nothing/undefined). |
TL:DR; SleeplessByte is correct; I had a stale spec file and didn't know it. Aha! I see that you changed the test suite ten days ago in PR#649: Previously, the spec used an intermediate variable:
...which passes Now, the spec is:
...which passes nothing/undefined to twoFer, and so the default value is triggered. I had gotten it into my head that the "default value" solution was working for the regular function, but not for the arrow function. But I can't reproduce that behavior now; if I re-test with the older version of the spec, both the "regular" flavor and "arrow" flavor fail, as expected. So this is definitely an issue caused by me running a stale spec. Normally, I would depend on Git to tell me whether my local files were stale or not, but in this case since we're using a CLI instead of git, I don't have that guardrail. I'll need to remember to make sure that my specs are up to date before getting further into the weeds on language issues :) Thanks very much for the rapid input, @SleeplessByte ! |
A quick sanity check is to first check your solution page at the bottom for a message that it's outdated. If it's not, then at least in the system you're working against the latest first. Now check the |
Okay, this is a bit odd.
On my environment, the suggested "arrow function" flavor of solution for
two-fer
is this:However, that solution doesn't actually pass for me. The default value 'you' is not set successfully, and I get, in the failure:
When using arrow functions, it only works if I use ${name = 'you'} in the template string.
I've been Googling -- can I not use default values in arrow functions? and I can't really get a clear answer:
https://stackoverflow.com/questions/34354105/default-parameter-value-in-arrow-function
So I think one of these things are the case:
Any thoughts?
The text was updated successfully, but these errors were encountered: