I don't know if this is possible, but what I'd like to accomplish is assign a property value to an object from a function that is called. When the function for active is ran, I'd like to assign either a true or false as its value as the object is being created. Can we use self-executing functions in this way?
Here's my code, still in-progress, but is there something of this sort that is accomplish able in javascript?
graphObj.list.push({
name: graphData[i].name,
value: Math.floor(graphData[i].time / graphData[graphData.length - 1] * 100),
str: graphData[i].strTime
active: (function(){
if (activeActivityName != "" && graphData[i].name == activeActivityName){
return true;
} else {
return false;
}
})
});
()at the end for it to be immediately executed.()causes a syntax error, it appears as that isn't the proper syntax if this is possiblestrTime.