Write a JavaScript program for retrieving a position of character in a string.
<html>
<head>
<title>Retrieving a position of character in a string</title>
</head>
<body>
<script>
var text = "Hello from JavaScript";
document.write("Position of 'J' is : " + text.indexOf('J'));
</script>
</body>
</html>
