Simple JavaScript Example in Browser
In this topic, you will learn how to embed simple JavaScript in a Web page.
Create a file “abc.html” with below contents.
<html>
<head>
<script>
alert(“hi”);
</script>
</head>
<body>
</body>
</html>
Executing the JavaScript code in HTML file
Now to execute the JavaScript file, all you need to do is open the HTML file in browser. Note that your JavaScript code should go inside <script> tag.
You should see the alert saying “hi”.
Recent Comments