Change:
<!-- NOTE: If you're reporting a security issue, don't create a GitHub issue. Instead, email We will look into it immediately. --Describe your problem and how to reproduce it: is poorly describing splice function, one would expect call based on that, but real one is Add a Link to the page with the problem: Tell us about your browser and operating system: Browser Name: not applicable Browser Version: not applicable Operating System: not applicable If possible, add a screenshot here (you can drag and drop, png, jpg, gif, etc. in this box): hopefully not necessary
From what I've read in MDN's , it takes three parameters but the last parameter is variadic. Maybe we can reword the following if it's unclear for some:
So I think that "on addition to removing elements, we can use additional parameters, which represents one or more elements, to add them as well" would be better I am not experienced with that terminology, but it seems to me that is called with four parameters rather than three, but these four parameters are transformed into three.
So I think that "on addition to removing elements, we can use additional parameters, which represents one or more elements, to add them as well" would be better I am not experienced with that terminology, but it seems to me that is called with four parameters rather than three, but these four parameters are transformed into three. Also, describes its parameters as "start (...) deleteCount (...) item1, item2, ..." - rather than describing it as a function with three parameters.
Good points. I am not experienced as well and my understanding is probably wrong. Maybe someone with more experience about the terminology can chime in.
Good one! This is much clearer.
OK, I will submit PR (feel free to remind me to do that once is empty)
I think your wording is better. I checked GitHub and could not find where you have submitted a PR with this new verbiage. If anyone else would like to create a PR using wording above, that would be great! Thank you.
Unless I'm blind, didn't suggest a change, the quote he gave is directly from the challenge. I think he just suggested what part of the text might be changed. I think part of the problem is when you don't have a clear definition and understanding of the difference between a parameter and an argument. 1 parameter !== 1 argument. I also think using parameter and argument interchangeably, which is done all the time, can cause quite a bit of confusion to people when first learning. The third parameter takes a list as the argument: Maybe just add that, "a list of": You can still misunderstand it to mean an array. It really isn't until you see the prototype method signature (if the annotation used makes sense, otherwise it is just confusing), or better yet an example of the method being used that you can really understand it. Besides a change to the challenge text. I would also suggest the example given in the challenge be updated to add 2 hex colors, this would show the third parameter used as a list. Which is the required knowledge needed to pass the challenge.
Side note: I think the way the challenge example code was written is potentially harmful to people just starting out learning. It really muddies the water and gives a wrong impression of how objects and the splice method works. This is the example code: It is effectively is doing this, but in my opinion hides that fact by returning the array and by capturing the return.
I should have said suggestion is different, because the current challenge states: which is different from his suggestion: I still don't like here, they are placeholders. With the splice method any passed after the first two are the extra elements do be inserted by the splice. I am not sure how best to convey this without using the terminology, but since the challenge is about , we need to come up with something. Definitely think we need to refer to a list of arguments in the example you mention should be add and make it clear that a list is not an array which the current verbiage would almost indicate (third parameter), like it is a collection instead of just a listing of extra arguments.
It is definitely not additional parameters, it is one parameter accepting multiple arguments. Here is my first stab at it.
I like all but that last "Example usage". I think It makes the challenge unnecessarily long and you already have the best example above that part: Here is how you pass a list of values to the third parameter:
My example (or something simple like it) would be used instead of the example code given in the challenge. In my opinion, when first explaining a prototype method it should be simple and bare-bones. It should not have any complexity to it that is not needed. At least not in the first example given. I can appreciate the example tries to be less abstract and more real-world, but there is a number of problems with it. use of a second function. It just needlessly complicates the example, I don't think it is a good way to initially show how splice works. it is using the array. Passing the reference, then changing the original array only to return it and overwrite the original array anyway. Not good, in my opinion. it is using splice. It makes it look like the change to the array is local to the function and needs to be returned, when in fact that is not the case. is also another more subtle problem with the colorChange function. When passing a list to the third parameter of splice as a variable (newColor), how you need to pass the list changes. It does not work as you might expect from looking at the original code. Anyway, long story short, I suggest we simplify the code example. Side note: I think a deeper problem is how we seem to want the challenges to be "all-in-one". I truly believe starting super simple first and then in the next challenge, if deem necessary, giving a more complicated and "real-world" example, would be so much better. Sorry for the wall of text.
Sincere apologies if this is out of place, but I was rooting around for some places to make first contributions and came across this. Sometimes a lack of experience is the best form of insight, yes? So, that said, I think that lasjorg is right about this: Furthermore, I think the example change suggested by lasjorg is also much clearer and easier to process: I think that this example, paired with a clearer explanation of the material, would be sufficient. The other two examples lasjorg suggested become redundant in that case. The following would be enough to both explain the functionality of splice() being demonstrated and provide enough context to allow students to grasp its scope: Because the examples in the lesson description do not have proper code formatting (red text on a gray background, with no markup), I find that comments can be very distracting and confusing, since it adds the task of processing the location of the comment notation and the scope it covers (changing the size of the window or frame can change how many lines the comments reach). It's better, then, to be reserved in how much of the example box is utilized for comments, and conscious of their length. As such, I've attempted to minimize their footprint in the example, and opted for a block comment when the comment stands alone. Hope this is helpful somehow.
Thank you for your insight. We have dropped the ball on this one, but hopefully we can implement some kind of improvement in the near future. FYI - You will be happy to know that PR is an attempt to address the lack of code formatting which has plagued the challenges for quite a long time.
As a first time contributor I would be happy to assist in any way I can here.
We are still discussing exactly what needs to be done. Once we finalize the verbiage, we'll post here.
Hi All, first timer here. trying to understand what needs to be done. Request someone to let me know how to proceed further on this issue. Thanks in advance.
function htmlColorNames(arr) { // change code below this line (0, 2, "DarkSalmon", "BlanchedAlmond"); // change code above this line return arr; } // do not change code below this line (htmlColorNames(['DarkGoldenRod', 'WhiteSmoke', 'LavenderBlush', 'PaleTurqoise', 'FireBrick'])); use this code this going to help you ok if code runs then thumbs up follow to
<bI hope by using above code issue is solved </b<centerthank you then close this issue</center
Did you actually read the issue and what it pertains to? Do we have any final verdict on this? I like what came up with, do you have any objections?
yes i readed but () function can take more than two values if still this issue is not solved then ask
I also really like what came up with. It's clear, concise and focused on what you can do with .
or anybody else want to create a PR implementing what has proposed? We welcome such a PR.
Hi, beginner here. I am willing to make the changes proposed by .
Go for it!

Discussion:
## Description <section id='description'> <del> Remember in the last challenge we mentioned that <code>splice()</code> can take up to three parameters? Well, we can go one step further with <code>splice()</code> &mdash; in addition to removing elements, we can use that third parameter, which represents one or more elements, to <em>add</em> them as well. This can be incredibly useful for quickly switching out an element, or a set of elements, for another. For instance, let's say you're storing a color scheme for a set of DOM elements in an array, and want to dynamically change a color based on some action: </del> <ins> Remember in the last challenge we mentioned that <code>splice()</code> can take up to three parameters? Well, you can use the third parameter, comprised of one or more element(s), to add to the array. This can be incredibly useful for quickly switching out an element, or a set of elements, for another. </ins> ```js <del> function colorChange(arr, index, newColor) { arr.splice(index, 1, newColor); return arr; } let colorScheme = ['#878787', '#a08794', '#bb7e8c', '#c9b6be', '#d1becf']; colorScheme = colorChange(colorScheme, 2, '#332327'); // we have removed '#bb7e8c' and added '#332327' in its place // colorScheme now equals ['#878787', '#a08794', '#332327', '#c9b6be', '#d1becf'] </del> <ins> const numbers = [10, 11, 12, 12, 15]; const startIndex = 3; const amountToDelete = 1; numbers.splice(startIndex, amountToDelete, 13, 14); // the second entry of 12 is removed, and we add 13 and 14 at the same index console.log(numbers); // returns [ 10, 11, 12, 13, 14, 15 ] </ins> ``` <del> This function takes an array of hex values, an index at which to remove an element, and the new color to replace the removed element with. The return value is an array containing a newly modified color scheme! While this example is a bit oversimplified, we can see the value that utilizing <code>splice()</code> to its maximum potential can have. </del> <ins> Here we begin with an array of numbers. We then pass the following to <code>splice()</code>. The index at which to begin deleting elements (3), the number of elements to be deleted (1), and the elements (13, 14) to be inserted at that same index. Note that there can be any number of elements (separated by commas) following <code>amountToDelete</code>, each of which gets inserted. </ins> </section> ## Instructions