When you want to add something to an array, just push() it in:
var lyrics = ['push', 'it', 'real']; lyrics.push('good'); // [ 'push', 'it', 'real', 'good' ]
— Sorry to interrupt this program! 📺
Given the current situation with COVID-19, times are hard for most of us, but if you're stuck at home you can perhaps use that extra time to work on your front-end skills. Wes put all of his courses at 50% off to help out with the current challenge we're facing.
Plus, these are affiliate links, so if you purchase a course you help Alligator.io continue to exist at the same time! 🙏
The syntax is real simple:
You can also push multiple items at once:
myArray.push(item1, item2, item3);