<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JavaScript named function</title>
</head>
<body>
<pre> <!-- Use pre element for work document.writeln() method -->
<script type="text/javascript">
fun2(); // called!
function fun2() {
document.writeln("Hello world!");
} // named function expression
fun2(); // called
</script>
</pre>
</body>
</html>