Java Script
Java Script
Java Script is light weight interpreted programming document.write("Today ICT class is Run")
language with object oriented capabilities . </script>
Java Script language is case sensitive . Output
It is also known as live script . Today ICT class is Run
It is directly or indirectly embedded in HTML page.
The java script language resemble c, c++ , Java . For HTML Code :
All major Web browser like internet Explorer, <HTML>
Mazola firebox , Netscape Navigator , Opera and etc <Title>First Javascript program </title>
supported it . <body>
<script language="javascript">
Use of JavaScript : document.write("Today ICT class is Run");
1. Used for validative form . </script>
2. Displaying clock . </body>
3. display alter message . </HTML>
4. perfroming calculation and display result Output
on client side . Today ICT class is Run
Script is the head section : Script to be executed when they
Advantage of JavaScript : are called . Script in the body section : Script to be execution
1. Cross browser support . when the webpage lodes go in the body section .
2. Loght weight for fast downloading . The word document , write is a standard java script
3. Similaritics of C language . commands or displaying output message .
4. It is easy to learn and wirting code of program Question no 1. Write a program to calculate Multiplication of
5. It support in bulit software . three different number.
<script language="javascript">
Disadvantage of the javaScript : var a,b,c,multi;
1. Read and writing files can't be server side , only for a=parseInt(prompt("Enter the 1st number :"));
client side . b=parseInt(prompt("Enter the 2nd number :"));
2. All web browser can't be support it . c=parseInt(prompt("Enter the 3rd number :"));
multi=a*b*c;
Today ICT class is Run : document.write("The multiplication of three no.is:"+multi);
</script>
Output </script >
Output:
Integer :
In Java script it sizes 8 bytes .
It is used to store integers numbers (single number)
It can also contain Octal and Hexadecimal values.
Semi colon :
In javascript semi-colons are optional .
String :
It is simply communication of character that do not
change during the execution of program .
Example :
Operator :
In JavaScript operator is symbols which used in calculation or
manipulate different types of operators.
Operator can be classification in different categories:
1. Arithmetic operator
2. Comparison operator
3. Equality operator
4. Logical operator
5. Assignment operator
6. Bit wise operator
A. Arithmetical Operator :
It take numerical values as their operator and return a
single numerical values. The standard arithmetical operator is addition
subtraction, division, multiplication and remainder. This operator work
as they do in must other programming language. Java script provides the
arithmetical operators following so on.
Operators Description Example The volume is :3510
% (Modular) Return the integer 12%2=2
Question no 9: Write a program to input any number and
remainder of dividing
the two operator . find enter number is even and odd .
+ <script language="javascript">
var n;
n=parseInt(prompt("Enter the values of n is :"));
Program: if (n%2==0)
Write a program to calculation area of rectangle . {
/*Write a program to calculation area of rectangle.*/
<script language="javascript">
document.write(“It is even number”);
var l,b,rec; }
l=parseInt(prompt("Enter the values of the length is :")); else
b=parseInt(prompt("Enter the values of the breadth is :"));
rec=l*b ;
document.write("It is odd mumber”);
document.write("The volume is :"+rec); </script>
</script>
Output: