I am facing an issue with adding a new fruit to a string that is converted into an array. Here's the scenario:
var fruits = "banana,apple";
In an attempt to add a new fruit to this list, I tried converting it to an array and then using the push method like so:
var newFruit = "orange";
fruits
.split(",")
.push(newFruit);
However, I encountered a problem because when I split fruits
using ","
, it doesn't return a standard array which allows me to use the push()
function on it.
Is there a workaround for achieving this desired outcome?