Fix lesson, Add Items Using splice() - splice can take more than 3 parameters

Tell us what’s happening:

There is no indication that the ‘third’ element of splice can actually be multiple, comma-separated elements. The lesson says that splice takes three parameters. It makes it sound as though the items to add needs to be a single element, such as an array. And when the third element is an array, it returns the desired output but does not pass the test. Please fix the lesson portion on the side to explain that splice can take three OR MORE parameters.

Your code so far

function htmlColorNames(arr) {
  // change code below this line
  arr.splice(0,2,["DarkSalmon", "BlanchedAlmond"]);
  // change code above this line
  return arr;
// do not change code below this line
console.log(htmlColorNames(['DarkGoldenRod', 'WhiteSmoke', 'LavenderBlush', 'PaleTurqoise', 'FireBrick']));

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36.

Link to the challenge:

I can see your point and I can see how you considered an array for third parameter. Is a list a parameter or a variable number of optional parameters? Could use some clarification.

You could check if there is a similar issue already raised on the FCC github. If not, you could open an issue yourself. Don’t expect an immediate fix but it will be considered time permitting.

Good to know is that MDN has excellent documentation on all the array methods such as splice() and that all the other methods are linked down the left side of each page. At this stage in the challenges it is a good habit to start developing a short list of go-to resources beyond FCC anyways.

You might not remember the gritty details of each and every one of these methods but it is good to know what is available and where to go to get the particulars when the need arises.

MDN also has similar documentation for Object, Map, and other built-ins too.