How to get data from widget button?

I got a widget which show a question with multiple answers, I am trying to get the value from each button, here a snippet of the code

<button data-bind-value="{{loop.value}}" onclick="windows.Result(event, {{loop.index}})"></button>

But it is not working, I get a "unexpected “{”… Is there a way to get a dynamically passed value for a button on onclick?

Never mind, I found a workarround that gets the job done

What was the work around?
Was just testing and realised you have windows.Result() rather than window.Result()

the windows.Result() rather than window.Result() is just a typo I made while writing this post.