Die Verwendung von Schleifen und Splits zum Ersetzen und Löschen von Elementen wird sehr einfach, aber praktisch getestet, insbesondere für Anfänger geeignet
<! DocType> <html> <kopf> <meta http-äquiv = "content-type" content = "text/html; charset = utf-8"/> <titels> Schleifen und Aufteilungen verwenden, um Elemente zu ersetzen und zu löschen </title> <script> var arr = new Array ("ab", "aa", "bc", "ab", "ss", "ab", "ss", "ab", "ss", "dd", "ab", "aa", "aa", "aa", "aa"); while (arr.indexof ("ab")! = -1) {console.log ("1"+arr); arr.splice (arr.indexof ("ab"), 1, "**"); } console.log (arr); while (arr.indexof ("**")! = -1) {console.log (arr); arr.splice (arr.indexof ("**"), 1); } console.log (arr); </script> </head> <body> </body> </html>IE8 unterstützt Indexof und Spleiß nicht