48
Use Array like a Stack (LIFO Mode)
2021-03-31 - JavaScript
1// JS Tip of the Day
2// Use Array like a Stack (LIFO Mode)
3
4let heroes = ['Batman', 'Superman', 'Green Arrow', 'Cyborg'];
5arr.push('Flash'); // ['Batman','Superman', 'Green Arrow', 'Cyborg', 'Flash']
6arr.pop(); // ['Batman','Superman', 'Green Arrow', 'Cyborg']
7
#JStipoftheday