Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1 +1,36 @@
// Write your solution here!

const cats = ['Milo', 'Otis', 'Garfield'];

function destructivelyAppendCat() {
cats.push('Ralph');
};

function destructivelyPrependCat() {
cats.unshift('Bob');
};

function destructivelyRemoveLastCat() {
cats.pop();
};

function destructivelyRemoveFirstCat() {
cats.shift();
};

function appendCat() {
return appendCat = [...cats, 'Broom'];
};

function prependCat() {
return prependCat = ['Arnold', ...cats];
};

function removeLastCat() {
return removeLastCat = [...cats.slice(0,-1)];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return removeLastCat = [...cats.slice(0,-1)];
return removeLastCat = [...cats.slice(0, -1)];

};

function removeFirstCat() {
return removeFirstCat = [...cats.slice(1)];
};