This works:
<html>
<script type="text/javascript">
function lala() {
console.log("lala");
}
</script>
<body>
<button onclick="lala()">lala</button>
</body>
</html>
But having that in jsfiddle works not:
<button onclick="lala()">lala</button>
function lala() {
console.log("lala");
}
https://jsfiddle.net/clankill3r/715kha38/
Uncaught ReferenceError: lala is not defined
I saw some old answers on stackoverflow regarding this problem but those seem to be invalid those days.