0
<!DOCTYPE html>
<html>
<body>
 <h2>JavaScript Slice Function</h2>
<h2>slice()</h2>
 <p>slice() returns selected array elements as a new array:</p>
 <p id="workingcode"></p>
 <script>
const fruits = ["Java", "ServiceNow", "PHP", "JavaScript", "Angular"];
const citrus = fruits.slice(1, 3);
 document.getElementById("workingcode").innerHTML = citrus;
</script>
 </body>
</html>

Output
JavaScript Slice Function
slice()
slice() returns selected array elements as a new array:

ServiceNow,PHP

Slice() returns selected array elements as a new array JavaScript
admin Changed status to publish December 19, 2023