What is position? It doesn’t seem to be declared anywhere?
To answer your question: splice() returns an array of the removed elements (Array.prototype.splice() - JavaScript | MDN). You are passing 1 as the deleteCount to splice() so you will get an array with one deleted element in it. It’s at position 0 of the array so to access it you use [0].
My code was incomplet…position is a const position = index + offset;
A bit confusing when things starts getting nested but your explanation helps a bit. Thank you!