javascript - how can I extract in js object and operation -
there obejct nestobject
want
nestobject['weakness']['modules']['weakness'][item] = {'enabled': true}; nestobject['weakness']['modules']['weakness'][item]['check_list'] = file_leak_list;
i try this:
var aaa = nestobject['weakness']['modules']['weakness'][item] aaa = {'enabled': true}; aaa['check_list'] = file_leak_list;
but doesn't work
how can write code elegant?
that json maybe?
var nestobject = { weakness:{ modules:{ weakness:{ item:{enabled:true, check_list:"file_leak_list"} } } } }; alert(aaa.enabled); aaa.enabled = false; alert(aaa.enabled); alert(aaa.check_list); aaa.check_list = "some file"; alert(aaa.check_list);
http://jsfiddle.net/bernardobj/kdnsc8fr/
can provide jsfiddle ??
Comments
Post a Comment