Others



What is JavaScript?


JavaScript is the programming language for the Web. It is a lightweight, interpreted programming language.JavaScript is an open source and cross-platform.we can change HTML content using JavaScript.

JavaScript - Hello World

JavaScript code is written between script tags.It can placed anywhere in the HTML Page.

Syntax
<html>
  <body>
    <script language='javascript' type='text/javascript'>
      document.write("Hello World");
    </script>
  </body>
</html>

External JavaScript

We can keep the JavaScript code in a external file with '.js' extension.

script.js
let ele=document.getElementById("text");
ele.innerHTML='Hello World';

index.html
<html>
  <body>
    <h1 id='text'></h1>
    <script type='text/javascript' src='script.js'></script>
  </body>
</html>