配列を連結する
const a = [1, 2, 3] const b = [4, 5, 6] const c = [7, 8, 9] const result = [] [a, b, c].forEach(arr => result.push(...arr)) console.info(result) //-> [1, 2, 3, 4, 5, 6, 7, 8, 9]
牌語備忘録 -pygo
配列を連結する
const a = [1, 2, 3] const b = [4, 5, 6] const c = [7, 8, 9] const result = [] [a, b, c].forEach(arr => result.push(...arr)) console.info(result) //-> [1, 2, 3, 4, 5, 6, 7, 8, 9]
In [1]: 'hoge,fuga,moge,'.replace(',', '') Out[1]: 'hogefugamoge'
'hoge,fuga,moge,'.replace(',', '') //-> "hogefuga,moge,"
'hoge,fuga,moge,'.replace(/,/g, '') //-> "hogefugamoge"