LoginSignup
0
0

More than 3 years have passed since last update.

javascriptで文字列を分解して配列化メモ

Last updated at Posted at 2020-11-16

書き方

分割対象の文字列.split(区切りに使用する文字列)

今回の場合

LINEから受け取ったメッセージ「飲みに行きたい 名前」なので、


const message_arr = event.message.text.split(" ")

全角スペースかな。

全角スペースを入れていないときは、配列の2個目の要素は「undefined」になる。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0