Quantcast
Channel: Node.jsタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 8883

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

$
0
0

書き方

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

今回の場合

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

constmessage_arr=event.message.text.split(" ")

全角スペースかな。

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


Viewing all articles
Browse latest Browse all 8883

Trending Articles