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' ]
Educative.io: Learn by Coding ⤵
“I sure am glad I took that JS course” – You, 2 weeks from now probably.The syntax is real simple:
myArray.push(toAdd);
You can also push multiple items at once:
myArray.push(item1, item2, item3);