Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试过了:
var test = code.replace("-", "%2D");
但如果 code = "1-2-3",它只替换一个破折号。我如何更换两者?
利用 //
var test = code.replace(/-/g, "%2D");