[JavaScript] JavaScript中通过pop方法移除数组的最后一个元素 →→→→→进入此内容的聊天室

来自 , 2019-06-07, 写在 JavaScript, 查看 116 次.
URL http://www.code666.cn/view/f29a1797
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <p id="demo">Click the button to remove the last array element.</p>
  6.  
  7. <button onclick="myFunction()">Try it</button>
  8.  
  9. <script>
  10. var fruits = ["Banana", "Orange", "Apple", "Mango"];
  11.  
  12. function myFunction()
  13. {
  14. fruits.pop();
  15. var x=document.getElementById("demo");
  16. x.innerHTML=fruits;
  17. }
  18. </script>
  19.  
  20. </body>
  21. </html>
  22.  
  23. //javascript/7863

回复 "JavaScript中通过pop方法移除数组的最后一个元素"

这儿你可以回复上面这条便签

captcha