window.echoTest = echoTest;
<a href="#" class="echo-link">click me</a>
document.querySelector('.echo-link').addEventListener('click', event => { event.preventDefault(); echoTest('test msg') })