0% found this document useful (0 votes)
1 views4 pages

JAVA Script

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

JAVA Script

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

JAVA Script

In HTML, JavaScript code is inserted between <script> and </script> tags.

JavaScript is a high-level, dynamic programming language used to make web pages interactive.
It is a core technology of the World Wide Web, alongside HTML and CSS.

JavaScript is a versatile language used for web development, adding interactivity, dynamic
content, and user-friendly features like sliders, forms, and animations. It’s also used in web
apps, backend services (via [Link]), game development, and mobile apps.

What is the difference between JavaScript and Java?


JavaScript and Java are distinct languages with different purposes. Java is an object-oriented
programming language for building standalone applications, while JavaScript is primarily used
to enhance web pages with interactivity and dynamic content.

What is JavaScript DOM ?


The JavaScript DOM (Document Object Model) lets you interact with and manipulate HTML and
CSS. It represents a web page as a tree of objects, enabling real-time updates, style changes,
and event handling for dynamic, responsive pages.

How do you include JavaScript in an HTML document?


JavaScript can be included in an HTML document in three ways:
 Inline, by placing it directly within HTML elements.
 Internal, by placing it within a <script> tag in the HTML document.
 External, by linking to a separate .js file using the <script src=”[Link]”></script>
tag.

First Program (Example 1)


<!DOCTYPE html>

<html>

<head>

<title></title>

</head>

<body>

<script>
[Link]('Hello World');

</script>

</body>

</html>

Alert Method

The alert() method displays a popup alert box with the message. It’s useful for simple
notifications or warnings but should be used sparingly as it disrupts user interaction.
Example 2

<!DOCTYPE html>

<html>

<head>

<title></title>

</head>

<body>

<script>

alert('Hello World');

</script>

</body>

</html>

JavaScript Comments
Comments help explain code (they are not executed and hence do not have any logic
implementation). We can also use them to temporarily disable parts of your code.

Single Line Comments


<!DOCTYPE html>

<html>

<head>
<title></title>

</head>

<body>

<script>

alert('This is My First Program');

[Link]('Single line comment');//alertmethod

</script>

</body>

</html>

MultiLine Comment

<!DOCTYPE html>

<html>

<head>

<title></title>

</head>

<body>

<script>

/*this

alert('This is My First Program');

[Link]('Single line comment');*/

[Link]("All The Function remain invisiable");


</script>

</body>

</html>

You might also like