Self1sh
September 12, 2020, 6:38am
1
i’m pretty sure they wanted me to do this this way lmao
const myConcat = (arr1, arr2)=>[1,2,3,4,5];
console.log(myConcat([1, 2], [3, 4, 5]));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36
.
Challenge: Write Arrow Functions with Parameters
Link to the challenge:
Learn to code. Build projects. Earn certifications.Since 2015, 40,000 graduates have gotten jobs at tech companies including Google, Apple, Amazon, and Microsoft.
ilenia
September 12, 2020, 6:40am
2
what happens if I call myConcat([2,9], [1,7,12])
? it returns [1,2,3,4,5]
you should really try to use function parameters
This is how I went throw high school, then when I entered university I was panicking because I knew nothing.
1 Like
Self1sh
September 12, 2020, 10:29am
4
this code works because they only request myConcat() should return [1, 2, 3, 4, 5].
i made this post so they fix it
Sky020
September 12, 2020, 11:25am
5
Hello there,
This issue was very recently discussed, and the lesson was changed slightly. You can read about it here:
freeCodeCamp:master
← Issue-03:master
opened 06:59PM - 11 Jun 20 UTC
Checklist:
- [x] I have read [freeCodeCamp's contribution guidelines](htt… ps://contribute.freecodecamp.org).
- [x] My pull request has a descriptive title (not a vague title like `Update index.md`)
- [x] My pull request targets the `master` branch of freeCodeCamp.
- [x] All the files I changed are in the same world language, for example: only English changes, or only Chinese changes, etc.
Closes #39049
**Before:**
The lesson on page will allow the user to pass the test using the following answer;
```
const myConcat = (arr1, arr2) => arr1.push(arr2);
console.log(myConcat([1, 2], [3, 4, 5]));
```
And the console below displays "3"
Further testing reveals it will also pass with the following code;
```
const myConcat = () => {};
console.log(3);
```
**After:**
It won't pass something like this now:
```
const myConcat = () => {};
console.log(3);
```
or this:
` #const myConcat = eval("(func"+"tion(){})");`
The just of the discussion was (altered slightly):
The content of the function seems pretty irrelevant. We just need a test that checks if they turn the function into an arrow function with the two parameters.
At the end of the day, the lesson is focussed on teaching arrow functions . You have done just that. Therefore, your code is allowed to pass.
const myConcat = (arr1, arr2)=>[1,2,3,4,5];
Is this a useful function…not really. So, the question is: Did you learn from the lesson how to create an arrow function?
1 Like