1const str = 'The quick brown fox jumps over the lazy dog.';
2
3console.log(str.slice(31));
4// expected output: "the lazy dog."
5
6console.log(str.slice(4, 19));
7// expected output: "quick brown fox"
1var input = 'john smith~123 Street~Apt 4~New York~NY~12345';
2
3var fields = input.split('~');
4
5var name = fields[0];
6var street = fields[1];
1const str = 'The quick brown fox jumps over the lazy dog.';
2
3console.log(str.slice(31)); // expected output: "the lazy dog."
4
5console.log(str.slice(4, 19)); // expected output: "quick brown fox"
6
7console.log(str.slice(-4)); // expected output: "dog."
8
9console.log(str.slice(-9, -5)); // expected output: "lazy"
10
11// source : https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/String/slice
1newStr = str.split(''); // or newStr = [...str];
2newStr.splice(2,5);
3newStr = newStr.join('');