JSFiddle - React, Tailwind, and code Playground
by Luis Valle
JavaScript
var specialObjectArray = [];
for (var i=0; i < 10; i++) {
var currentObject = {
name: "Name" + i,
someeventname: function () {
var currentName = this.name;
console.log("someeventname was triggered on " + currentName);
this.someothereventname();
}
};
currentObject.someothereventname = function () {
var currentName = this.name;
console.log("someothereventname was triggered on " + currentName);
};
specialObjectArray.push(currentObject);
}
for (var i=0; i < specialObjectArray.length; i++) {
specialObjectArray[i].someeventname();
}