Sitemap
Pusparasa Ayilavan

Pusparasa Ayilavan

JavaScript Tutorial | Introduction JS

3 min readNov 21, 2023

--

JavaScript is a versatile and widely used programming language that enables you to add interactivity and dynamic behavior to web pages. Originally created to make web pages more interactive, JavaScript is now a key component of modern web development, allowing developers to build complex and powerful web application.

Press enter or click to view image in full size
JavaScript

Key features and aspects of JavaScript include:

  1. Client-Side Scripting: JavaScript is primarily used as a client-side scripting language, running in the browser to manipulate the Document Object Model (DOM) of a web page. This enables developers to dynamically update content, respond to user actions, and create a more engaging user experience.
  2. Syntax: JavaScript’s syntax is similar to other programming languages like Java and C, making it relatively easy for developers to learn if they are familiar with these languages. It is a high-level, interpreted language, which means that you don’t need to compile your code before running it.
  3. Variables and Data Types: JavaScript supports various data types such as numbers, strings, booleans, objects, and arrays. Variables are used to store and manipulate data, and they can be dynamically typed, meaning the type of a variable can change during runtime.
  4. Functions: Functions are a fundamental building block in JavaScript. You can define functions to encapsulate reusable pieces of code and execute them when needed. Functions can also take parameters and return values.
  5. Event Handling: JavaScript is commonly used to handle events triggered by user actions, such as clicks, key presses, and mouse movements. This allows developers to create interactive and responsive web pages.
  6. Asynchronous Programming: JavaScript supports asynchronous programming using mechanisms like callbacks, promises, and async/await. This is crucial for handling tasks that might take some time to complete, such as fetching data from a server without blocking the user interface.
  7. Object-Oriented Programming (OOP): JavaScript is a prototype-based, object-oriented language. Objects play a central role, and you can create and manipulate them to organize and structure your code.
  8. Libraries and Frameworks: JavaScript has a rich ecosystem of libraries and frameworks, such as jQuery, React, Angular, and Vue.js, which simplify and streamline the development of complex web applications.

Application of JavaScript

JavaScript is used to create interactive websites. it’s mainly used for

  1. Client-side validation
  2. Dynamic drop-down menus
  3. Displaying date and time
  4. Displaying pop-up windows and dialogs boxes
  5. Displaying clock

Simple JavaScript Programme

Press enter or click to view image in full size
Click Script

External JavaScript Advantages

It separates HTML and code

Get Pusparasa Ayilavan’s stories in your inbox

Join Medium for free to get updates from this writer.

It make HTML and JavaScript easier to ready and maintain

Cached JavaScript files can speed up page loads

External References

With a full URL

With a file path

Without any path

Disadvantages of External JavaScript

  1. The web browser needs to make an additional http request to get the js code.
  2. We need to check each file that depends on the commonly created external javascript file.
  3. The stealer may download the coder’s code using the url of the js file.
  4. If it is a few lines of code, then better to implement the internal javascript code.
  5. A tiny to a large change in the js code may cause unexpected results in all its dependent files.
  6. If two js files are dependent on one another, then a failure in one file may affect the execution of the other dependent file.

--

--