JSFiddle - React, Tailwind, and code Playground
JavaScript
// EXERCISE 1:
const testArray = [{
value: 1
}, {
value: 2
}, {
value: 3
}]
// Changes all values in an array with a 0.
function fillArrayWithZeros(arr) {
arr.forEach((e) => {
e.value = 0;
});
return arr;
}
console.log('RESULT 1');
console.log('Resulting array', fillArrayWithZeros(testArray));
console.log('Original array', testArray);