how to Initialize and fill an array with the specified values in javascript
// 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 ]