<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JavaScript function returning a value</title>
</head>
<body>
<pre> <!-- Use pre element for work document.writeln() method -->
<script type="text/javascript">
function cal(radius ){
var area;
area = 3.14 * radius * radius;
return area;
}
var radius = 2.0, circle_area;
circle_area = cal(2.0);
document.writeln("Radius of Circle : " + radius);
document.writeln("Area of Circle : " + circle_area);
</script>
</pre>
</body>
</html>