Practical No 3
Practical No 3
<html>
<head>
</head>
<body>
<script>
</script>
</body>
</html>
<html>
<head>
</head>
<body>
<script>
</body>
</html>
<html>
<head>
</head>
<body>
<script>
items[0] = "One";
items[1] = "Two";
items[2] = "Three";
document.write(items[0]);
document.write("<br>"+ items[1]);
document.write("<br>"+items[2]);
</script>
</body>
</html>
<html>
<head>
<script>
scripts[0]="PHP";
scripts[1]= "ASP";
scripts[2] = "JavaScript";
scripts[3] = "HTML";
for (i=0;i<scripts.length;i++)
document.write(scripts[i] + "<br>");
</script>
</head> </html>
<html>
<head>
<script>
arr[i] = i;
</script>
</head>
</html>
<html>
<head>
<script>
</script>
</head>
</html>
<html>
<head>
</head>
<body>
<script>
var num = new Array(3); for (i = 0; 1 < 3; i++) num[i] = new Array(3);
num[0][0] = 1;
num[0][1] = 2;
num[0][2] = 3;
num[1][0] = 4;
num[1][1] = 5;
num[1][2] = 6;
num[2][0] = 7;
num[2][1] = 8;
num[2][2] = 9;
document.write(num[i][j] + "<br>");
</script>
</body>
</html>
<html>
<head>
<body>
<script>
items[0] = "One";
items[1] = "Two";
items[2] = "Three";
items[3] = "Four";
items.push("Five");
items.push("Six", "Seven");
items.unshift("Zero");
items[items.length]="Eight";
items[items.length]="Nine";
for (i=0;i<items.length;i++)
</script>
</body>
</html>
<html>
<body>
<script>
products[1] = 'Water';
products[2] = 'Pizza';
products[3] = 'Fan';
products.sort();
document.write(products[i] + '<br>');
</script></body>
</html>
<html>
<head>
</head>
<body>
<script>
</script>
</body>
</html>
<html>
<head>
</head>
<body>
<script>
arr1.sort();
</script>
</body>
</html>
<html>
<body>
<script>
var fruits = ["Banana", "Watermelon", "Chikoo", "Mango", "Orange", "Apple"];
fruits.sort();
document.write(fruits+"<br>");
fruits.reverse();
document.write(fruits+"<br>");
</script>
</body>
</html>
<html>
<body>
<script>
document.write(subjects);
</script>
</body>
</html>
<html>
<head>
<body>
<script>
items[0] = "One";
items[1] = "Two";
items [2]="Three";
var s1=items.join()
document.write(s1 + "<br>");
var s2=items.join('-')
document.write(s2 + "<br>");
var s3=items.concat()
document.write(s3 + "<br>");
num[0] = "Four";
num[1]="Five";
num[2] = "Six";
var s4=items.concat(num);
document.write(s4 + "<br>");
</script>
</body>
</html>
<html>
<body>
<script>
var products = new Array();
products[1] = 'Water';
products[2] = 'Soap';
products[3] = 'Pizza';
document.write(str);
document.write('<br>');
document.write(str);
</script>
</body>
</html>
<html>
<head>
<script>
var newarr=arr.slice(1,3)
</script>
</head>
</html>
<html>
<head>
</head>
<body>
<script>
items[0] = "One";
items[1] = "Two";
items[2]="Three";
items.shift();
for (i=0;i<items.length;i++)
</script>
</body>
</html>
<html>
<head>
</head>
<body>
<script>
items[0] = "One";
items[1] = "Two";
items[2] = "Three";
items.pop();
for (i=0;i<items.length;i++)
</script>
</body>
</html>
<html>
<body>
<script>
var fruits=["Banana","Watermelon","Chikoo","Mango","Orange","Apple"];
document.write(fruits+"<br>");
document.write(fruits+"<br>");
fruits.splice(0,2);
document.write(fruits+"<br>");
</script>
</body>
</html>
<html>
<body>
<script>
document.write(fruits);
document.write("<br>"+citrus);
</script>
</body>
</html>
<html>
<head>
</head>
<body>
<script>
var value=arr[key];
document.write(key+"=" + value + '<br>');
</script>
</body>
</html>
<html>
<head>
</head>
<body>
<script>
o["One"] = 1;
o["Two"] = 2;
o["Three"] = 3;
for (var i in o)
</script>
</body>
</html>
<html>
<head>
<script>
arr.pop()
arr.shift()
arr.reverse()
arr.unshift(1)
</script>
</head>
</html>