Greetings,
splice(7,1)(21,3)
This snippet of code is likely to trigger an error because Array.prototpy.slice generates a new array.
The outcome would be similar if you attempted the following:
const a = [1,2,3]
const b = a.splice(1,1);
b(2,1) // b.splice(...) is not a function
UPDATED:
It's possible that there exists a more efficient or superior approach but...
You can refine it for your specific scenario as follows:
const array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21];
const first = array[7];
const second = array[21];
// Insert elements at certain positions in array (second and third)
array.splice(2, 0, first, second)
// Delete first from the array (index is 7 + 2 due to addition of 2 elements)
array.splice(9, 1)
// Exclude 21 from the array (index is 22 - 1 due to adding 2 elements and deleting 1, note: number 21 holds index 22)
array.splice(21, 1);