slice javascript string 1

slice javascript string

const str = 'The quick brown fox jumps over the lazy dog.';

console.log(str.slice(31));
// expected output: "the lazy dog."

console.log(str.slice(4, 19));
// expected output: "quick brown fox"

Here is what the above code is Doing:
1. The first console.log() statement is logging the string starting from the 31st character.
2. The second console.log() statement is logging the string starting from the 4th character and ending at the 19th character.

Similar Posts