I have an empty array for example called const arr = [];
and when I click the button in page I want to create new Object inside this array, I do that with this following code line
//add is button element
const add = document.querySelector(".add");
//value is input element
const valueInput = document.querySelector(".value");
add.addEventListener('click', ()=> {
arr.push(new Object)
console.log(arr)
})
it makes object but I want to grab this Object and insert inside new property for example to called "text" and array should look like that
arr[{text: ''}]
and every click I want to create new object in this array and property still must be text, inside the text I will put input value
I tried on my own
arr.push(new Object = {text})
arr.Object.text = valueInput.value
but both of them give me left-hand error