Loading

Introduction

What is JavaScript? 

  • Javascript is a high-level, dynamic, object-oriented programming language  used for web development
  • It is primarily executed in web browsers to add interactivity and create dynamic web pages.

Link JavaScript File in HTML 

There are two ways to add JavaScript to an HTML file:

1. Internal JS:

  •  We can add JavaScript directly to o HTML file by writing the code inside the <script> tag.
  •  The <script> tag can be placed inside the <head> or the <body> tag.

2. External JS:

  •  Write JavaScript code in files having an extension .js and then link this file inside the <head> tag of the HTML file in which we want to add this code.

Features of JavaScript:

  1. Interactivity: We can create interactive web pages by responding to user actions, such as clicks, keyboard input, and mouse movements. 
  2. Dynamic Typing: JavaScript is dynamically typed, language means you don't need to declare data types for variables.
  3. Versatility: JavaScript is used for a wide range of tasks beyond web development. It can be used for server-side scripting (Node.js), game development, mobile app development, desktop application development, and more.
  4. Scripting Language: JavaScript is a "scripting language" because it is typically executed line by line, making it well-suited for tasks that require automation and user interaction.