将数组中含有 java 字符的改为 abc
let str = ["java","javascript","php","python","javaEE","c#","c"]; console.log(str); let rep = new Array(); for(let i in str){ rep[i] = str[i].replace(/java/g,"abc"); } console.log(rep);