Javascript integration

Hi,
I am exploring how to integrate javascript in Gmetri experience,
I have gone through the javascript Documentation in Gmetri website,
What I am trying to achieve here is on button click, want to perform some action

Ex:Display a message in console.

I have tried in this way:

In embed html element I have given my button code

Code snippet :click

And I have given this function definition in the advanced settings(custom script)

Code snippet :

**But it didn’t work, I got reference error **

Uncaught ReferenceError: myFunction is not defined
at HTMLButtonElement.onclick (1612863911376?ut=eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOjE1MzcsImlhdCI6MTYxMjg2MzgwOCwiZXhwIjoxNjEyOTUzODA4fQ.oW3msNepwwboQ5e9lOiMXUhFZglJxE6MQ4xNVi9tnO9uKyk7TdKYMeQzc9B_5xqf_eSYHcFvOR-z7Keq-zcQwA:1)

What will be the correct way to achieve this?