Interactive Web Development


What is JS? JavaScript is a cross-platform, object-oriented scripting language used to make webpages interactive (e.g., having complex animations, clickable buttons, popup menus, etc.).

Untitled

JS files are placed in <script> tag in html, and by default the display property of script is none

Running JavaScript in a Web Browser:

  1. Create an HTML file: Create a new HTML file using a text editor.

    1. Internal JS

      index.html

      <!DOCTYPE html>
      <html lang="en">
      <head>
          <meta charset="UTF-8">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <title>Document</title>
      </head>
      <body>
      	<script>
      	  alert("Hello, World!");
      	</script>
      </body>
      </html>
      
    2. External JS

      <!DOCTYPE html>
      <html lang="en">
      <head>
          <meta charset="UTF-8">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <title>Document</title>
      </head>
      <body>
          <script src="script.js"></script>
      </body>
      </html>
      
  2. Open in a Web Browser: Save the HTML file and open it in a web browser.

  3. View Console Output: Open the browser's developer tools (by right-clicking on the page, selecting "Inspect," and navigating to the "Console" tab) to view console output and errors.


Untitled

<aside> 💡 ECMAScript === JavaScript

</aside>