I’ve had a somewhat liberating epiphany recently. The methods built into a programming language can be written from scratch using primitive building blocks like if-else statements and loops. Built-in methods exist to bundle complicated procedures behind one simple interface; but they're simply solutions to common problems so a programmer doesn’t have to write them over and over again. Programming is problem solving, whether I use complex or simple tools.
It's the same in design. There are many of nuts and bolts to every tool. Sketch and Figma are filled with smart details meant to make a designer’s life easier. But I also know, by virtue of my experience, that all I need is a blank canvas, the rectangle tool, type and color. Tools are helpful, but the work happens in thinking about and experimenting on a problem enough that eventually a solution starts to emerge—regardless of the tool used.
Splice is a robust method. With one single line of code, I can shorten an array, remove items at specific index positions, or even insert multiple new items at a location. It works in place and therefore on the array itself.
In my own version of splice, I built a couple of dedicated methods to perform each major procedure. Things like shortening an array, deleting an item(s) at a particular location, and inserting as many elements as passed onto the function sequentially into the array.
A method to shorten the array:
Methods to delete an item(s):
A method to insert an item(s):
All in all, lot’s to learn – but that was fun.