SHARE
TWEET

Untitled

a guest Oct 22nd, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <p>Click the button to add elements to the array.</p>
  6.  
  7. <button onclick="myFunction()">Try it</button>
  8.  
  9. <p id="demo"></p>
  10.  
  11. <script>
  12. var fruits = ["Banana", "Orange", "Apple", "Mango"];
  13. document.getElementById("demo").innerHTML = fruits;
  14.  
  15. function myFunction() {
  16.   fruits.splice(2, 0, "Lemon", "Kiwi");
  17.   document.getElementById("demo").innerHTML = fruits;
  18. }
  19. </script>
  20.  
  21. </body>
  22. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top