String.prototype.slicebeginnerconst str = 'Hello, World!'
str.slice(7, 12) // β 'World'
str.slice(-6, -1) // β 'World'
str.slice(7) // β 'World!'Use slice() to extract a portion of a string by start and end indices, supporting negative indices.
Use .slice(n, n+1) to extract exactly one character at index n.
Challenge: Implement charAt(str, n) that returns the character at index n using slice.
charAt('hello', 1) // β 'e'
charAt('world', 4) // β 'd'