How to do Javascript

Explain javascript with this:

onclick=alert(hello world);

And then a function

<script>
function greeting () {
alert(hello my friends);
</script>

On a link then add

onclick="greeting()";