JavaScript, Programming, Technology, Coding, Tutorial.
notation supports negative indices, making it easy to extract elements from the end of the array: const colors = ['red', 'green', 'blue', 'yellow', 'orange']; const slicedColors = colors[-3:-1]; console.log(slicedColors); // Output: ['blue', 'yellow'] Here, colors[-3:-1] extracts elements starting