javascript array methods delete() on January 08, 2022 Get link Facebook X Pinterest Email Other Apps javascript array methods delete() Html part <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>new</title> </head> <style> body{ width: 400px; height: 400px; background-color: #333; color: #fff; margin-left: 100px; margin-top: 50px; } </style> <body> <h1>javascript array methods delete() </h1> <h2 id="e"></h2> <h2 id="r"></h2> <script> let fruits = ["apple","banana", "mango"]; document.getElementById ("e").innerText = "The first fruit is " + fruits[2]; delete fruits[2]; document.getElementById ("r").innerText = "The first fruit is " + fruits[2]; </script> </body> </html> Comments
Comments
Post a Comment