Here I'm using a TypedArray Uint32Array
. Where I have some set of data in the data. I want to replace the first 10 data of the array with some value. I'm trying to set it to the first 10 value but it is not binding respective to the first 10 data of the array. Kindly, help me out. Thanks in advance.
var arrD = new Uint32Array(32)
arrD.slice(0, 12).forEach(function (item) {
arrD[item] = 5
console.log(arrD)
})
You could use the
.fill
array function: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill