「JavaScript」Array.from()のサンプル
書式
Array.from() メソッドは、配列を浅くコピーされた新しい Array インスタンスを生成します。
使用例
console.log(Array.from('test’));
console.log(Array.from([4, 5, 8], x => x * 2));
実行結果
> Array [“t", “e", “s", “t"]
> Array [8, 10, 16]
Coding Changes the World
書式
Array.from() メソッドは、配列を浅くコピーされた新しい Array インスタンスを生成します。
使用例
console.log(Array.from('test’));
console.log(Array.from([4, 5, 8], x => x * 2));
実行結果
> Array [“t", “e", “s", “t"]
> Array [8, 10, 16]