logo

Polyglot CheatSheet - Slices

Last Updated: 2022-04-04

Python

arr_slice = arr[start:end]
str_slice = str[start:end]

JavaScript

const arrSlice = arr.slice(start, end);
const strSlice = str.substring(start, end);