0% found this document useful (0 votes)
5 views

Java Script Class 1

Uploaded by

akashpk655
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Java Script Class 1

Uploaded by

akashpk655
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Chapter 6 Client Side Scripting Using JavaScript

JavaScript is a commonly used client side scripting language. It is a case


sensitive language developed by Brenden Eich for Netscape Web browser. JavaScript
is used commonly because it is supported by all the web browsers.

<Script>
This tag is used to include script programs in the html document. The
‘Language’ attribute is used to specify the name of the scripting language.
A script program can be written inside ‘head section’ or ‘body section’. An
html document can contain any number of script programs.
Eg: <html>
<head>
<title> JavaScript- Welcome</title>
</head>
<body>
<script language= “JavaScript”>
document.write (“Welcome to JavaScript”);
</script>
</body>
</html>

JavaScript Engine
This is a virtual machine used by the browser for executing JavaScript code.
Every web browser will have a JavaScript engine. The JavaScript code is interpreted
at run time by the JavaScript engine.
If JavaScript is disabled in a web browser, it will not execute the script code.
Browser will simply ignore the script code and we will not get the webpage intact.

Creating Functions in JavaScript


A function is a group of statements with a name. JavaScript provides a lot of
built-in functions which can be used for different purposes. We can also create our
own functions using the keyword ‘function’.

Client Side Scripting Using JavaScript- Class 1 Page 1


Eg:
<Html>
<head>
<title> JavaScript- Function</title>
<script language= “JavaScript”>
function print()
{
document.write(“Welcome to JavaScript”);
document.write(“This is user-defined function”);
}
</script>
</head>
<body>
<script language= “JavaScript”>
print();
</script>
</body>
</html>
(In this example, a function ‘print’ is created in the head section. It can also be
created in the body section. A function created in a program can be called (invoked)
from that program, whenever we need.)

Data Types in JavaScript


Data type specifies the type of data and the operations that can be performed on
this data. JavaScript has 3 main data types- Number, String and Boolean.
1. Number
All types of numbers in JavaScript are represented with this data type.
2. String
A string is a group of characters like letters, digits, symbols, etc. enclosed
within double quotes.
3. Boolean
This data type has only two values. They are ‘true’ and ‘false’.

Client Side Scripting Using JavaScript- Class 1 Page 2

You might also like