JSFiddle - React, Tailwind, and code Playground
JavaScript
function basket() {
this.items = [];
this.addItem = function(item) {
this.items.push(item);
};
this.show = function() {
console.log('items: ', this.items);
}
}
var x = new basket();
_.each(['banana', 'apple', 'kiwi'], function(item) { x.addItem(item); });
x.show();