TheaterFire

I'm trying to learn JS on FreeCodeCamp. I'm unsure where they want me to change the code. Can anyone help?

Posted by BadBroBobby@reddit | ProgrammerHumor | View on Reddit | 29 comments

I'm trying to learn JS on FreeCodeCamp. I'm unsure where they want me to change the code. Can anyone help?

Reply to Post

29 Comments

AccountsCostNothing@reddit

const shorterList = list.splice(0,2)
View on Reddit #449288

The_Slay4Joy@reddit

Slice, not splice
View on Reddit #455558

AccountsCostNothing@reddit

The splice() method is used to add or remove elements of an existing array and the return value will be the removed items from the array.
View on Reddit #456194

The_Slay4Joy@reddit

Variable name implies that you're supposed to return the original list without its first 2 elements, not the removed elements
View on Reddit #456244

AccountsCostNothing@reddit

[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Array/splice](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice) Try it.
View on Reddit #456258

Amphibutter@reddit

I would look up list slicing in javascript, but this isn’t the ideal sub for these sorts of questions. I recommend one of the r/learn subreddits
View on Reddit #454819

AltAccountMfer@reddit

This isn’t the place for these questions
View on Reddit #453579

lupinegrey@reddit

Instructions unclear. Coder is potate.
View on Reddit #453210

KakashiTheRanger@reddit

``` function removeFirstTwo(list) { // Only change code below this line const [, , ...shorterList] = list; // Change this line // Only change code above this line return shorterList; }``` In the updated code: - Instead of assigning the original list to shorterList, we use destructuring assignment to remove the first two elements of the array and assign the remaining elements to shorterList. - We then return shorterList instead of the original list. With these changes, the removeFirstTwo function will now remove the first two elements of the array passed to it and return a new array containing the remaining elements.
View on Reddit #452421

BokuNoMaxi@reddit

Const shorterList = list.slice(2) Nothing more to change if list is an array.
View on Reddit #444527

nigerianprince199@reddit

Think you missed the joke there
View on Reddit #445091

Makel_Grax@reddit

They did add more to the joke tho.
View on Reddit #450945

Achtelnote@reddit

I did too, what's the joke?
View on Reddit #447793

ShadowPengyn@reddit

It says where, as in which line needs to be changed. The joke is that it’s obvious which line needs changing (but it also took me a second to realise this is meant by „where“)
View on Reddit #448887

Simphonia@reddit

That there a bit too many comments being very specific about what should be modified.
View on Reddit #448885

ajorigman@reddit

r/woosh
View on Reddit #446775

superglidestrawberry@reddit

It's missing giant red circle and arrows pointing on it. YouTube thumbnail style.
View on Reddit #444908

xCreeperBombx@reddit

🔴⬆️⬆️⬆️
View on Reddit #450700

OracularHades20@reddit

it's missing something. function removeFirstTwo(list) { // TODO: do my job. return "na" }
View on Reddit #449968

typescriptDev99@reddit

Turn on line numbers, that'll help!
View on Reddit #449488

rt_burner@reddit

Not sure man maybe look at the documentation
View on Reddit #449061

Flashy_You3428@reddit

i cant see any lines!! only words..
View on Reddit #447849

jonnyclueless@reddit

OK, I admit I am stumped...
View on Reddit #446986

PuzzleheadedTutor807@reddit

are you SURE they want you to change some code?
View on Reddit #445600

adudyak@reddit

Push it back, saying they missed to draw a line
View on Reddit #445234

Stiggan2k@reddit

Change it to "const shorterList = st;"
View on Reddit #445082

Yorick257@reddit

I think it's right after the closing curly bracket. But I'm no JS expert
View on Reddit #445054

AnimeeNoa@reddit

It seems the target is to create a list without the first two entrys. So the line with the const list want probably a change to fit this. Sry can't help directly, js is not my fav language.
View on Reddit #444557

Hello_World_PHP_JS@reddit

Apparently they want you to change the line that ends with the comment: //Change this line
View on Reddit #444390