1. 8
  1. 1

    The syntax isn’t really anything like Python’s though. :(

    const array = SliceArray(1, 2, 3, 4);
    // Outputs: [2, 3]
    array[[1,-1]]
    
    1. 1

      It’s not literally the same, but it mirrors the syntax extremely closely. The example you list there would be array[1:-1] in Python, and with Slice it is array[[1,-1]]. Any slice that you could write in Python will work in exactly the same in Slice if you substitute the colons with commas and use double brackets. You can’t change the meaning of colons in JavaScript, so this is as close as a JavaScript library can get.

    2. 1

      That’s really cool. It’s always fun to see folks extend js’s syntax like this.