1
2let myFish = ['angel', 'clown', 'mandarin', 'sturgeon']
3let removed = myFish.splice(2, 0, 'drum')
4
5// myFish is ["angel", "clown", "drum", "mandarin", "sturgeon"]
6
7let words: string[] = [
8 'What',
9 'I',
10 'do',
11 'create,',
12 'I',
13 'cannot',
14 'not',
15 'understand.',
16];
17
18let newWords = words.splice(2, 1, 'cannot');
19let newWords2 = words.splice(5, 2, 'do not');
20//console.log(newWords);
21console.log(words.join(' '));
22
23//What I cannot create, I do not understand.
1
2
3
4
5 let deletedScores = scores.splice(0, 3);Code language: JavaScript (javascript)