0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

arr.splitメソッドを使って多次元配列の子要素を配列化する

0
Last updated at Posted at 2020-09-04
paizaラーニングのレベルアップ問題を解いていて、「あっ、これそろそろ覚えとかないと!」と感じたので、これを機にQiitaにメモ書きしておきます。
具体的には、arr.mapの引数内にコールバック関数としてarr.splitを配置。
下記のようになります。
qiita.js
let arr = [ 'Kiri 1', 'Kyo 2' ]
let splited = arr.map((value) => value.split(" "));
console.log(splited);

// 結果:[ [ 'Kiri', '1' ], [ 'Kyo', '2' ] ]
0
0
1

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?