You must create a function called arrayOfObjects
that receives a number as a parameter and returns an array of objects that have a property called value
that contains the value of the number and its predecessors.
example
ArrayOfObjects(3)
should return:
[{value: 1}, {value: 2}, {value: 3}]
my code
function arrObj(number){
let newArray = [];
for(let i = 0;i<number; i++){
newArray.push(number.object)
}
console.log(newArray)
}
arrObj(5)
I'm new with objects, can someone help me?