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 needle = '/'+key+'/g'; str = str.replace(needle, trans[key]);
これのためにあなたの針を交換してください:
var needle = new RegExp(key, "g");