Skip to content

Commit 2839cc8

Browse files
VeraVera
authored andcommitted
index.js
1 parent e66a501 commit 2839cc8

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

index.js

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,34 @@
1-
// Write your solution here!
1+
const cats = ["Milo", "Otis", "Garfield"];
2+
3+
function destructivelyAppendCat(Ralph){
4+
return cats.push(Ralph);
5+
}
6+
7+
function destructivelyPrependCat(Bob){
8+
return cats.unshift(Bob);
9+
}
10+
11+
function destructivelyRemoveLastCat(Garfield){
12+
return cats.pop(Garfield);
13+
}
14+
15+
function destructivelyRemoveFirstCat(Milo){
16+
return cats.shift(Milo);
17+
}
18+
19+
function appendCat(Broom){
20+
return [...cats, Broom];
21+
}
22+
23+
function prependCat(Arnold){
24+
return [Arnold, ...cats];
25+
}
26+
27+
function removeFirstCat(){
28+
return cats.slice(1);
29+
}
30+
31+
function removeLastCat(){
32+
return cats.slice(0,2);
33+
}
34+

0 commit comments

Comments
 (0)