I'm trying to get the value of an array/object by passing KEY that is splitted from data attribute.
Please take a look of this whole scenario.
1st - passing the data-* to an element
<a data-action='{"content":"content.login"}' ... >val</a>
2nd - get the data attribute value
var da = ele.data("action");
var c = da.content;
var c0 = c.split('.')[0];
var c1 = c.split('.')[1];
4th - array/obj
var content = {
login : "..."
};
3rd - trying to get the val of array
console.log(c0[c1]);
result - undefined
Can someone give me the solution so that it logs the exact value of content.login by simply calling c0[c1]?
c0suposed to be a string like"content", right? So this can't workc0[c1]...