I have been trying to take an empty array and then pushing any string in it using a button’s onClick event. Also ,I need to show all items in the array on the same page.
here’s my code
The value for every single items’ value is an empty string, so you are printing it. What were you expecting to see? An empty string is an empty string, if you want a non-empty string, then you actually need to use a non-empty string.