[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.
``` 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.
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“)
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.
29 Comments
AccountsCostNothing@reddit
The_Slay4Joy@reddit
AccountsCostNothing@reddit
The_Slay4Joy@reddit
AccountsCostNothing@reddit
Amphibutter@reddit
AltAccountMfer@reddit
lupinegrey@reddit
KakashiTheRanger@reddit
BokuNoMaxi@reddit
nigerianprince199@reddit
Makel_Grax@reddit
Achtelnote@reddit
ShadowPengyn@reddit
Simphonia@reddit
ajorigman@reddit
superglidestrawberry@reddit
xCreeperBombx@reddit
OracularHades20@reddit
typescriptDev99@reddit
rt_burner@reddit
Flashy_You3428@reddit
jonnyclueless@reddit
PuzzleheadedTutor807@reddit
adudyak@reddit
Stiggan2k@reddit
Yorick257@reddit
AnimeeNoa@reddit
Hello_World_PHP_JS@reddit