How can I access fields in my javascript?

Hi,

Sorry if the question is very simple but I'm can´t seem to find a solution to my problem, maybe because I'm new to SugarCRM development. I managed to add a button near the "Edit" button when you open a contact and I managed to make it call a hardcoded phone number through the app I needed.

The problem was that when I tried to make the javascript that does what I previously described use the phone number field present in the current contact, I simply couldn't find a way. How can I store the contact that I have opened in a var for later use in the javascript?

Thanks in advance!