Javascript assign property from function -


i don't know if possible, i'd accomplish assign property value object function called. when function active ran, i'd assign either true or false value object being created. can use self-executing functions in way?

here's code, still in-progress, there of sort 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;                 }             })         }); 

i want discourage using iife here since believe inappropriate use of iife. how assigning result of condition:

graphobj.list.push({     name: graphdata[i].name,     value: math.floor(graphdata[i].time / graphdata[graphdata.length - 1] * 100),     str: graphdata[i].strtime,     active: (activeactivityname != "" && graphdata[i].name == activeactivityname) }); 

Comments

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -