Array Examples
const cats = ["Milo", "Otis", "Garfield"];
β Add a name destructively to the end of array:
function destructivelyAppendCat(name){ cats.push(name = 'Ralph'); };
β Add a name destructively to the start of array:
function destructivelyPrependCat(name){ cats.unshift(name = 'Bob'); };
β Remove last cat destructively of array:
function destructivelyRemoveLastCat(){ cats.pop(); };
β Remove first cat destructively of array:
function destructivelyRemoveFirstCat(){ cats.shift(); };
β Appends a cat to the cats array and returns a new array, leaving the cats array unchanged
function appendCat(){ let name_1 = ["Milo", "Otis", "Garfield", "Broom"]; return name_1; };
β Prepends a cat to the cats array and returns a new array, leaving the cats array unchanged
function prependCat(){ let name_2 = ["Arnold", "Milo", "Otis", "Garfield"]; return name_2; };
β Removes the last cat in the cats array and returns a new array, leaving the cats array unchanged - Non Destructive
function removeLastCat(){ let kittens = cats.slice(0, cats.length-1); return kittens; };
β Removes the first cat from the cats array and returns a new array, leaving the cats array unchanged - Non Destructive
function removeFirstCat (){ let kittens = cats.slice(1); return kittens; };















