Pra 3
Pra 3
CLASS:- CO5I(A)
ROLL NO:-532
SUBJECT:- CSS(22517)
PRACTICAL NO:- 3
Aim: Write a JavaScript program to declare an array using Array Literal.
Code:-
<!DOCTYPE html>
<html>
<head>
<title>Sumedh Raut</title>
</head>
<body>
<h1>Array Literal</h1>
<script>
document.write(name);
</script>
</body>
</html>
Output:-
Aim: Write a JavaScript program to declare an array using Array Constructor
Code:-
<!DOCTYPE html>
<html>
<head>
<title>Sumedh Raut</title>
</head>
<body>
<script>
name[0] = "Sumedh";
name[1] = "Raut";
name[2] = "CO5I";
name[3] = "32";
name[4] = "GT&MC";
document.write(name);
</script>
</body>
</html>
Output:-
Aim: Write a JavaScript program to print array element using For Loop
Code:-
<!DOCTYPE html>
<html>
<head>
<title>Sumedh Raut</title>
</head>
<body>
<script>
document.write(names[i] + "<br>");
document.write(num[i] + "<br>");
</script>
</body>
</html>
Output:-
Code:-
<!DOCTYPE html>
<html>
<head>
<title>Sumedh Raut</title>
</head>
<body>
<script>
sports.push("Bowling", "Hockey");
sports.pop();
document.write("<br><br>After POP array elements : " + sports);
</script>
</body>
</html>
Output:-
Code:-
<!DOCTYPE html>
<html>
<head>
<title>Sumedh Raut</title>
</head>
<body>
<script>
sports.unshift("Hockey");
</script>
</body>
</html>
Output:-
Aim: Write a JavaScript program to perform Splice and slice methods of Array.
Code:-
<!DOCTYPE html>
<html>
<head>
<title>Sumedh Raut</title>
</head>
<body>
<script>
</script>
</body>
</html>
Output:-