JavaScript gets some elements of the array through slice function

From , 4 Years ago, written in JavaScript, viewed 55 times.
URL https://pastebin.vip/view/15825aee
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <p id="demo">Click the button to extract the second and the third elements from the array.</p>
  6.  
  7. <button onclick="myFunction()">Try it</button>
  8.  
  9. <script>
  10. function myFunction()
  11. {
  12. var fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
  13. var citrus = fruits.slice(1,3);
  14. var x=document.getElementById("demo");
  15. x.innerHTML=citrus;
  16. }
  17. </script>
  18.  
  19. </body>
  20. </html>
  21.  
  22.  
  23. //javascript/7867

Reply to "JavaScript gets some elements of the array through slice function"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website