Skip to main content

Command Palette

Search for a command to run...

Introduction to JavaScript

Published
1 min read
Introduction to JavaScript
P

I am Priyanshu Sharma. Programming enthusiast, Web Developer, and BlockChain Developer from India. I am obsessed with learning new things and improving my skills. I have worked on a variety of projects. I am currently enrolled in Computer Science & Engineering at Maharaja Surajmal Institute of Technology, New Delhi. I am very passionate about improving my coding skills & developing applications & websites.

JavaScript is an object-oriented programming language commonly used for making interactive web pages.

Implementing JavaScript in HTML

There are three main ways to include JavaScript in HTML.

  1. Inline JavaScript
    In this method, JavaScript code is written directly inside HTML elements using attributes like onclick, onchange, etc.

  2. Internal JavaScript (Embedded Script)

    Here, JavaScript code is written inside the <script> tag within the same HTML file. The <script> tag is usually placed inside the <head> or just before the closing </body> tag.

  1. External JavaScript

    In this method, JavaScript code is written in a separate .js file and linked to the HTML file using the src attribute.