Skip to content

Commit 44e8bb9

Browse files
VeraVera
authored andcommitted
commit tree 17608f2
1 parent e66a501 commit 44e8bb9

File tree

2 files changed

+178
-1
lines changed

2 files changed

+178
-1
lines changed

.results.json

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
{
2+
"stats": {
3+
"suites": 11,
4+
"tests": 9,
5+
"passes": 9,
6+
"pending": 0,
7+
"failures": 0,
8+
"start": "2022-06-02T06:13:08.713Z",
9+
"end": "2022-06-02T06:13:09.368Z",
10+
"duration": 655
11+
},
12+
"tests": [
13+
{
14+
"title": "is assigned an initial value of [\"Milo\", \"Otis\", \"Garfield\"]",
15+
"fullTitle": "index.js cats is assigned an initial value of [\"Milo\", \"Otis\", \"Garfield\"]",
16+
"duration": 2,
17+
"currentRetry": 0,
18+
"err": {}
19+
},
20+
{
21+
"title": "appends a cat to the end of the cats array",
22+
"fullTitle": "index.js Array functions destructivelyAppendCat(name) appends a cat to the end of the cats array",
23+
"duration": 0,
24+
"currentRetry": 0,
25+
"err": {}
26+
},
27+
{
28+
"title": "prepends a cat to the beginning of the cats array",
29+
"fullTitle": "index.js Array functions destructivelyPrependCat(name) prepends a cat to the beginning of the cats array",
30+
"duration": 0,
31+
"currentRetry": 0,
32+
"err": {}
33+
},
34+
{
35+
"title": "removes the last cat from the cats array",
36+
"fullTitle": "index.js Array functions destructivelyRemoveLastCat() removes the last cat from the cats array",
37+
"duration": 2,
38+
"currentRetry": 0,
39+
"err": {}
40+
},
41+
{
42+
"title": "removes the first cat from the cats array",
43+
"fullTitle": "index.js Array functions destructivelyRemoveFirstCat() removes the first cat from the cats array",
44+
"duration": 1,
45+
"currentRetry": 0,
46+
"err": {}
47+
},
48+
{
49+
"title": "appends a cat to the cats array and returns a new array, leaving the cats array unchanged",
50+
"fullTitle": "index.js Array functions appendCat(name) appends a cat to the cats array and returns a new array, leaving the cats array unchanged",
51+
"duration": 1,
52+
"currentRetry": 0,
53+
"err": {}
54+
},
55+
{
56+
"title": "prepends a cat to the cats array and returns a new array, leaving the cats array unchanged",
57+
"fullTitle": "index.js Array functions prependCat(name) prepends a cat to the cats array and returns a new array, leaving the cats array unchanged",
58+
"duration": 0,
59+
"currentRetry": 0,
60+
"err": {}
61+
},
62+
{
63+
"title": "removes the last cat in the cats array and returns a new array, leaving the cats array unchanged",
64+
"fullTitle": "index.js Array functions removeLastCat() removes the last cat in the cats array and returns a new array, leaving the cats array unchanged",
65+
"duration": 1,
66+
"currentRetry": 0,
67+
"err": {}
68+
},
69+
{
70+
"title": "removes the first cat from the cats array and returns a new array, leaving the cats array unchanged",
71+
"fullTitle": "index.js Array functions removeFirstCat() removes the first cat from the cats array and returns a new array, leaving the cats array unchanged",
72+
"duration": 1,
73+
"currentRetry": 0,
74+
"err": {}
75+
}
76+
],
77+
"pending": [],
78+
"failures": [],
79+
"passes": [
80+
{
81+
"title": "is assigned an initial value of [\"Milo\", \"Otis\", \"Garfield\"]",
82+
"fullTitle": "index.js cats is assigned an initial value of [\"Milo\", \"Otis\", \"Garfield\"]",
83+
"duration": 2,
84+
"currentRetry": 0,
85+
"err": {}
86+
},
87+
{
88+
"title": "appends a cat to the end of the cats array",
89+
"fullTitle": "index.js Array functions destructivelyAppendCat(name) appends a cat to the end of the cats array",
90+
"duration": 0,
91+
"currentRetry": 0,
92+
"err": {}
93+
},
94+
{
95+
"title": "prepends a cat to the beginning of the cats array",
96+
"fullTitle": "index.js Array functions destructivelyPrependCat(name) prepends a cat to the beginning of the cats array",
97+
"duration": 0,
98+
"currentRetry": 0,
99+
"err": {}
100+
},
101+
{
102+
"title": "removes the last cat from the cats array",
103+
"fullTitle": "index.js Array functions destructivelyRemoveLastCat() removes the last cat from the cats array",
104+
"duration": 2,
105+
"currentRetry": 0,
106+
"err": {}
107+
},
108+
{
109+
"title": "removes the first cat from the cats array",
110+
"fullTitle": "index.js Array functions destructivelyRemoveFirstCat() removes the first cat from the cats array",
111+
"duration": 1,
112+
"currentRetry": 0,
113+
"err": {}
114+
},
115+
{
116+
"title": "appends a cat to the cats array and returns a new array, leaving the cats array unchanged",
117+
"fullTitle": "index.js Array functions appendCat(name) appends a cat to the cats array and returns a new array, leaving the cats array unchanged",
118+
"duration": 1,
119+
"currentRetry": 0,
120+
"err": {}
121+
},
122+
{
123+
"title": "prepends a cat to the cats array and returns a new array, leaving the cats array unchanged",
124+
"fullTitle": "index.js Array functions prependCat(name) prepends a cat to the cats array and returns a new array, leaving the cats array unchanged",
125+
"duration": 0,
126+
"currentRetry": 0,
127+
"err": {}
128+
},
129+
{
130+
"title": "removes the last cat in the cats array and returns a new array, leaving the cats array unchanged",
131+
"fullTitle": "index.js Array functions removeLastCat() removes the last cat in the cats array and returns a new array, leaving the cats array unchanged",
132+
"duration": 1,
133+
"currentRetry": 0,
134+
"err": {}
135+
},
136+
{
137+
"title": "removes the first cat from the cats array and returns a new array, leaving the cats array unchanged",
138+
"fullTitle": "index.js Array functions removeFirstCat() removes the first cat from the cats array and returns a new array, leaving the cats array unchanged",
139+
"duration": 1,
140+
"currentRetry": 0,
141+
"err": {}
142+
}
143+
]
144+
}

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)