javascript array method splice() on January 08, 2022 Get link Facebook X Pinterest Email Other Apps JavaScript array method splice() 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 method splice()</h1> <h2 id="start"></h2> <h2 id="start1"></h2> <script> let num = ["1","2","3","4"]; let num2 = ["one","two","three", "four"]; document.getElementById ("start").innerText = num + num2; num.splice(2,4,"six","nine"); document.getElementById ("start1").innerText = num + num2; </script> </body> </html> Comments
Comments
Post a Comment