diff --git a/index.js b/index.js index 132693a35c..88357d63db 100644 --- a/index.js +++ b/index.js @@ -1 +1,33 @@ -// Write your solution here! +const cats = ["Milo", "Otis", "Garfield"]; + +function destructivelyAppendCat (name) { + cats.push(name); +} + +function destructivelyPrependCat (name) { + cats.unshift(name); +} + +function destructivelyRemoveLastCat () { + cats.pop(); +} + +function destructivelyRemoveFirstCat () { + cats.shift(); +} + +function appendCat (name) { + return [...cats, name]; +} + +function prependCat (name) { + return [name, ...cats]; +} + +function removeLastCat () { + return cats.slice(0, cats.length - 1); +} + +function removeFirstCat () { + return cats.slice(1); +}