14
10Dev
28d

I just spend 30 minutes debugging a JS bug that was caused by using the array method 'slice' instead of 'splice'

FUCK THIS!

Why tf does js have 2 methods that are similar in function and damn near identical in name

FUCK THIS SHIT

Comments
  • 4
    Get you some typescript. The signatures go a long way to scream at you that you're probably using the wrong method.
  • 0
    @SortOfTested I'm working on it. For now, I have to use js
  • 2
    Hats off to you sir, you actually posted a valid complaint about JS.
  • 1
    Those are rookie numbers, I spend at least 2h on errors like that
  • 0
    My guess would be because English language has words slice and splice:

    - slice: create a slice of original, e.g. a slice of bread
    - splice: interweave [a piece of rope] into another [piece of rope]
  • 0
    I just keep them straight by remembering “splice” is “slice” with another letter in it, so “splice” is the one where you alter the array and “slice” is the one where you copy. It’s a stupid way to remember, but eh. Works for me.
Add Comment