replace(/,/g, '')
时间: 2024-01-17 22:05:29 浏览: 66
回答: replace(/,/g, '')的作用是将字符串中所有的逗号替换为空。\[3\]在JavaScript中,replace()方法可以接受一个正则表达式作为参数,其中/g表示全局匹配,即替换所有匹配到的逗号。所以,replace(/,/g, '')会将字符串中所有的逗号替换为空。
#### 引用[.reference_title]
- *1* *3* [js中 replace(/\//g, ‘‘) 什么作用](https://blog.csdn.net/PanPa_WoNiu/article/details/107816996)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [【前端】全局替换(replace//g)](https://blog.csdn.net/weixin_38792911/article/details/108870502)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文