字符串替換的方法

字符串的替換方法 1.replace( )方法使用很是簡單 *例子 let box=「abcd」 let box1=box.replace(「a」,「5」) console.log(box1) //「5bcd」web *2還能夠以這樣用正折的屬性/g let box=「a1b2a3c」 let box1=box.replace(/a/g,「0」) console.log(box1)//"01b20
相關文章
相關標籤/搜索