News for hackers. Stuff that matters.
Re:Mnemonic for Shift() and Unshift()? by kondrei on Friday March 29, 2024 @11:30PM (#39871610)
I have this problem with splice and slice too
Re:Mnemonic for Shift() and Unshift()? by saaliklok on Saturday March 30, 2024 @10:54PM (#39880939)
Oof same, I'm always going back to the docs for these
Re:Mnemonic for Shift() and Unshift()? by galaxyLogic on Sunday March 31, 2024 @12:36AM (#39881479)
I try to get by with slice() since it is simpler to understand. Semantics is "taking a slice". splice() has a meaning of not only splitting but also putting slices back together, and is used less often. I too always have to look up its definitions from docs, partly because I use it so infrequently.
Re:Mnemonic for Shift() and Unshift()? by big_paps on Sunday March 31, 2024 @11:20AM (#39885049)
I somehow remembered that with : splice is more „evil“ because it changes the original. I know, it makes no sense ..