How can I extract the following value of the variable Test?
"test_bookmarks", "Janice Scott", "Birmingham all" from the javascript
object into another variable?
The image comes from the console log of Google Chrome.
How can I extract the following value of the variable Test?
"test_bookmarks", "Janice Scott", "Birmingham all" from the javascript
object into another variable?
The image comes from the console log of Google Chrome.
let states = e.$$state.value;
let labels = states.map(state => state.label); //[ 'test_bookmarks', 'Janice Scott', 'Birmingham_bil' ]
for (var i=0; i<=e["$$state"].value.length-1; i++) {
var obj = e["$$state"].value[i];
console.log(obj.label);
}
If you see the value of "value" key, it tells you that it is an array. That means the if you do something like:
$$state.value[*].label
here * stands for any integer, this way you'll get the values of the label property.
So, if you want to access the first label then it would be like:
$$state.value[0].label
this will give you "test_bookmarks".