javascript - I could not substituted JSON file object to "[]{}" structure JS Object -


---'./setindex.json'-----

{     "property":[         "second",         "third",         "fourth",             *             *         "end"        ] } 

this code able substitute json file object js object.

var setindex = require('./setindex.json') var actionfunction = {     "first": this.firstaction.bind(this) }; for(var = 0; < setindex.property[i].length; i++){     actionfunction[setindex.property[i]] = this.setmultiactions.bind(this,number); } 

but, don't know how substitute json file object {}[] type of js object. how should inside for loop?

var setindex = require('./setindex.json') var actionfunction = {     "first": this.firstaction.bind(this) }[listnum]; for(var = 0; < setindex.property[i].length; i++){     actionfunction[setindex.property[i]][listnum] = this.setmultiactions.bind(this, i); } 

output result

typeerror: cannot set property 'first' of undefined 


Comments