var str = "haha" str.replace("h","b") //out "baha" 只能替换第一个
如果需要全局替换 str.replace(/h/g,"b") //out "baba"