🚍 Array Methods
- push - add to end
- pop - remove from end
- shift - remove from start
- unshift - add to start
👈 push() - add to end
let movieLine = ["tom", "nance"];
movieLine[2] = "pablo";
movieLine;
movieLine.push('oliver');
movieLine;
movieLine.push('eva');
movieLine;
movieLine.push('harry', 'hermione');
movieLine;
🤛 pop() - remove from end
movieLine;
movieLine.pop()
movieLine;
let person = movieLine.pop();
person;
movieLine;
🏋️♂️ barbell example (stack & queue)
let barbell = [];
barbell.push(45);
barbell.push(45);
barbell.push(25);
barbell.push(10);
barbell.push(2.5);
barbell;
barbell.pop();
barbell.pop();
barbell.pop();
barbell.pop();
barbell.pop();
🤜 shift() - remove from start
movieLine;
movieLine.shift();
movieLine;
let nextPatron = movieLine.shift();
nextPatron;
movieLine; ["pablo", "oliver", "eva"]
movie.push('ryan');
movieLine.shift();
movieLine.shift();
movieLine.shift();
movieLine.shift();
movieLine.shift();
👉 unshift() - add to start
movieLine.push('jerry', 'deniz', 'kevin', 'carly');
movieLine;
movieLine.unshift('VIP');
movieLine;
movieLine.shift();
movieLine;