Text form Dropdown into button?

I'm trying to take the selected text from a dropdown menu (NameList_1) and put it into a button.

so if my dropdown list is this:

{
"Name 1": 0,
"Name 2": 1,
"Name 3": 45,
"Name 4": 23,
}

and from the dropdown I select Name 3 I want a button that's next to it, to also show this same text.

I cannot for the life of me figure this out.

the problem is that I need to use the dropdown index and not the value of the dropdown as the value of the names as you can see is not strictly 0,1,2,3,4,5 but is a random number.

thank you!

Alex

JS{
// this goes in the button's label
var values = @{dropdown_id.values},
    v = @{dropdown_id}

return Object.keys(values).find(k => values[k] == v)

}

dropdown_value.json (3.0 KB)

Thank you so much for this ... but .. would you be angry if I told you I'm still running v1.0.3?

Is this a possibility in v1.0.3?

thank you!

I think the only difference in this case would be to write JS{{ code }} instead of JS{ code }

this worked like a charm! Thanks Jean!!!