Is this an ok way to splice?

My code works to solve the challenge. Just wondering if it should? Is this an appropriate way to use splice?

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 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice

Yep your code looks good to me.

splice (index, how many you want to delete from that index, elements you want to add from that index… )

You code looks fine and does what the challenge requested.