📅  最后修改于: 2022-03-11 15:02:03.450000             🧑  作者: Mango
// how to Initialize and fill an array with the specified values in javascript
const initializeArrayWithValues = (n, val) =>
Array.from({length: n}).fill(val);
console.log(initializeArrayWithValues(4, 9)); // [ 9, 9, 9, 9 ]