You are on page 1of 13

Bhagwan Arihant Institute of

Technology

Subject :Basic Web Technology

Title :Java Script

Prepared by :
Name : Romil bhalala
Bhavya Ardeshna
Guided by:
Dhruvi Patel
Prof.Maitry Desai
Darshan lakhani
Mohit Kalathiya
Enrollment no:
Semester : 3rd
Branch : Information Technology
Introduction

 JavaScript is the world's most popular


programming language.
 JavaScript is the programming language of the
Web.
 JavaScript is easy to learn.
 JavaScript is used to create dynamic web pages.
2 ways to use javascript in HTML
 Internal or <Script> tag in HEAD or BODY tag.
 External <Script> tag with src attribute.
Internal / <script >

 Scripts can be placed in the <body>, or in the <head>


section of an HTML page, or in both.
 Example:
<html>
<head>
<script>
function myFunction() {
document.getElementById("demo").innerHTML = "Paragr
aph changed.";
}
</script>
</head>
<body>
External or other file
 H1.html
<html>
<body>

<h2>Demo External JavaScript</h2>

<p id="demo">A Paragraph.</p>

<button type="button" onclick="myFunction()">Try it</button>


<script src=“h1.js"></script>

</body>
</html>
 H1.js
 function myFunction() {
 document.getElementById("demo").innerHTML = "Paragraph
changed.";
 }
Variables in JavaScript

 3 Types of variable:
i: Var
Example: var x=“nothing”;
ii:Let
Example: Let x=“Everything”;
iii:Const
Example: Const x=“something:
Advantages

• Speed.
• Reduces load on the server.
• Ease of use.
• Rich Interface.
• Extended functionality.
• Popularity.
Disadvantages

• Client-Side Security Risk. ...


• Code Visibility. ...
• Different Interpretation Across Browsers. ...
• Single Inheritance. ...
• Issues with Debugging. ...
• Time-Consuming, especially with low network. ...
• Disabling JavaScript can hinder a web page.
Different way to Display Output

 Writing into an HTML element, using innerHTML.


 Writing into the HTML output using document.write().
 Writing into an alert box, using window.alert().
 Writing into the browser console, using console.log().
Comment in JavaScript

 Single line comments start with //.


 Any text between // and the end of the line will be ignored
by JavaScript (will not be executed).
 Example: let x = 5; // Declare x, give it the value of 5

 Multi-line comments start with /* and end with */.


 Any text between /* and */ will be ignored by JavaScript.
 Example: /*
The code below will change
the heading with id = "myH"
and the paragraph with id = "myP"
in my web page:
*/
Types Of Operator
• Arithmetic Operators
• Assignment Operators
• Comparison Operators
• String Operators
• Logical Operators
• Bitwise Operators
• Ternary Operators
• Type Operators
Thank You

You might also like