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.
如何将其解析为 int?
"'10'"
谢谢。
如果你真的不想用replace,你可以做
replace
var num = +str.match(/\d+/)
或者
var num = +str.slice(1,-1)
或者你可以这样做:
var num = +str.split("'")[1]