Exercise:
Use the pop() method to remove the last item from the fruits array.
Edit This Code:
See Result »
<!DOCTYPE html> <html> <body> <p id="demo"></p> <script> var fruits = ["Banana", "Orange", "Apple"]; document.getElementById("demo").innerHTML = fruits; </script> </body> </html>
Result:
Show Answer
Correct Code:
<!DOCTYPE html> <html> <body> <p id="demo"></p> <script> var fruits = ["Banana", "Orange", "Apple"]; fruits.pop(); document.getElementById("demo").innerHTML = fruits; </script> </body> </html>
Correct Result:
Hide Answer
Privacy Policy