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.
私が以下を持っている場合:
(8
8分割せずに番号を取得する方法はありますか? parseIntリターンの使用NaN。parseInt非数値を無視する代替手段はありますか?
8
parseInt
NaN
parseInt(str.replace(/[^\d]/g, ''), 10)
簡単な正規表現を使用してその番号を照合し、先頭に追加+して番号にキャストできます。
+
var num =+ '(8'.match(/\d+/)