I am working on my API. At this point, I want to replace the first object of an array such as:
If given data is:
const data = ["1", 2, 3, 4, 5, 6]
then I want: OUTPUT AS:
["New_text", 2, 3, 4, 5]
For this, I tried .splice function:
const new_data = data.splice(0, 1, "New_text")
But I am getting ["1"] as output. How can I do this?