Slice and splice: outstanding naming

I guess I am not the first one who asking this.

But why two somewhat similar methods called by so similar names? :joy:

I bet I will be confused by this dozens of times)

UPDATE. Did some googling, and it’s kind of a bummer: not a hint about history of creation.

I can’t tell you why they are named that way but you are not the only person who gets them confused for sure. It’s just one of those things you either have to memorize or be prepared to google a lot :slight_smile:

I guess i need MDN bookmark in Chrome for each of them)

There similarly named with similar actions, but if you look up the meaning of the words they have different meanings. slice basically means to chop something up and remove portions, and splice is adding two or more things together. What helps me is thinking of slice as slicing something off, nothing will be added back or combined together from those sliced off sections. And splice involves slicing something up, but ultimately those sliced pieces are going to be joined back together in some fashion.

I still usually forget that and look em up anyway just to be sure, but maybe it will help you.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.