Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2 views

JavaScript Basics

JavaScript is a scripting language that enhances web pages with interactivity, enabling features like form validation and animations. It can be embedded in HTML using the <script> tag, and variables and functions are declared using var, let, and const. An example program demonstrates an interactive button that triggers a message when clicked.

Uploaded by

Olives
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

JavaScript Basics

JavaScript is a scripting language that enhances web pages with interactivity, enabling features like form validation and animations. It can be embedded in HTML using the <script> tag, and variables and functions are declared using var, let, and const. An example program demonstrates an interactive button that triggers a message when clicked.

Uploaded by

Olives
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Introduction to JavaScript

1. Introduction

JavaScript is a scripting language that adds interactivity to web pages. It is used for dynamic
behavior like form validation, animations, and event handling.

2. JavaScript Syntax

JavaScript can be written inside an HTML file using the <script> tag:

<script>

alert('Hello, JavaScript!');

</script>

3. Variables and Functions

- Declaring variables:

var name = 'John';

let age = 25;

const PI = 3.14;

- Functions:

function greet() {

alert('Welcome to JavaScript!');

4. Sample Program: Interactive Button

<!DOCTYPE html>

<html>

<head>

<title>JavaScript Example</title>
</head>

<body>

<h2>Click the button</h2>

<button onclick='showMessage()'>Click Me</button>

<script>

function showMessage() {

alert('Hello! You clicked the button.');

</script>

</body>

</html>

You might also like