Hello,
You can write like this, you need know, class's instance's function is different with normal function.
<button onclick="handleClick();">click</button>
<script >
class Common {
   constructor(){
    this.URL=location.protocol + '//' + location.host+'';
   }
    showOk(){
     console.log('ok');
    }
}
const common = new Common();
function handleClick() {
  common.showOk();
}
</script>
Hope this helps!!
To know more about Java, join our Java course online today.
Thank you