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

CSS PR3 Writeup

Uploaded by

ahirekalpesh64
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

CSS PR3 Writeup

Uploaded by

ahirekalpesh64
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

<!

DOCTYPE html>
<html>
<body>
<h1>Practical 3: Develop Javascript to implements Array
functinalities </h1>
<h2>Array Methods</h2> Array here:
<h4>Fruit Array here : ["Banana", "Orange", "Apple",
"Mango"]</h4>
<p><b>The length property:</b></p> <p id="demo"></p>
<p><b>The toString() method </b></p> <p id="demo1"></p>
<p><b>The join() method </b></p> <p id="demo2"></p>
<p><b>The pop() method </b></p> <p id="demo3"></p>
<p><b>The push() method </b></p><p id="demo4"></p>
<p><b>The shift() method</b></p><p id="demo5"></p>
<p><b>The unshift() method </b></p><p id="demo6"></p>
<p><b>The splice() method </b></p><p id="demo7"></p>
<p><b>The slice() methods </b></p><p id="demo8"></p>
<script language="javascript">

const fruits = ["Banana", "Orange", "Apple", "Mango"];


let size =fruits.length;
document.getElementById("demo").innerHTML= size;
document.getElementById("demo1").innerHTML= fruits.toString();
document.getElementById("demo2").innerHTML= fruits.join("*");

fruits.pop();
document.getElementById("demo3").innerHTML = fruits;

fruits.push("Kiwi");
document.getElementById("demo4").innerHTML= fruits;

fruits.shift();
document.getElementById("demo5").innerHTML= fruits;

fruits.unshift("Lemon");
document.getElementById("demo6").innerHTML= fruits;

fruits.splice(2, 0, "Guava", "Kiwi");

document.getElementById("demo7").innerHTML= fruits;

const citrus =fruits.slice(1);


document.getElementById("demo8").innerHTML= fruits+ "<br><br>"
+ citrus;

</script>
</body>
</html>

You might also like