<html>
<body>
<p id="demo">Click the button to extract the third and fourth elements, using negative numbers.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction()
{
var fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
var myBest = fruits.slice(-3,-1);
var x=document.getElementById("demo");
x.innerHTML=myBest;
}
</script>
</body>
</html>