Html page:
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
JavaScript Page:
<script>
function myFunction()
{
var str = "HELLO
WORLD";
var n = str.charCodeAt(0);
document.getElementById("demo").innerHTML = n;
}
</script>
Output:
72
No comments:
Post a Comment