I've been working on updating my API and I've run into a problem. I need to replace the first element in an array like so:
Given the data:
const data = ["1", 2, 3, 4, 5, 6]
I want the output to be:
["New_text", 2, 3, 4, 5]
I attempted to use the .splice function:
const new_data = data.splice(0, 1, "New_text")
However, I'm only getting ["1"] as the output. How can I achieve the desired result?