Dr D. K.
Meena Assistant Professor Computer Science Department
Kalindi Collage University of Delhi
Java Script Lab manual
1. Write a JavaScript program to compute the sum of an array of
integers
2. Write a JavaScript program to determine whether a given year is a
leap year in theGregorian calendar
3. Write a JavaScript for loop that will iterate from 0 to 15. For each
iteration, it will check ifthe current number is odd or even, and
display a message to the screen
4. Write a JavaScript program to calculate multiplication and division of
two numbers
5. Write a JavaScript program to convert temperatures to and from
Celsius, Fahrenheit
6. Write a JavaScript function that reverses a number
7. Write a JavaScript function that checks whether a passed string is
palindrome or not
8. Write a JavaScript program to test the first character of a string is
uppercase or not
9. Write a JavaScript program to set the background colour of a
paragraph
10. Write a JavaScript program to check the given number is mobile
number or not usingform
11. Write a VBScript program for Fibonacci using for loop
12. Write a VBScript Program for age validation
13. Write a VBScript program to Copy contents of one folder to other
folder
14. Write a VBScript program to demonstrate the checkbox and list
box
Experiment-1
Aim:
To write a program to compute the sum of an array of integers using
javascript.
Procedure:
Start the execution of the program
Create the array with 6 elements
Calculate the sum of array of integers using for loop
Print the value of sum
Stop the execution of the program
Coding
<html>
<head>
<title>Compute the sum of an array of integers</title>
<script>
var array = [1, 2, 3, 4, 5, 6], s = 0, i;
for (i = 0; i < array.length; i += 1)
s += array[i];
document.write("Sum of array of Integers: "+s);
</script>
</head>
<body></body>
</html>
Result: Result: Sum of array of Integers: 21