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 var1="hi (help) me";
()間の文字を新しい変数にコピーしたいvar2。つまり、「助ける」という言葉です。Javascriptが初めてです。
()
var2
substring()とindexOf()を使用して、 の間のテキストを抽出できますparenthesis。
parenthesis
ライブデモ
var var2 = var1.substring(var1.indexOf('(')+1, var1.indexOf(')'))