Is there a way to convert an Object value to an array and add additional values to this new array? Let's consider the following scenario:
const object = {
names: "John"
}
How can the 'names' property be converted from a string to an array similar to this?
const namesFromApi = ['Ken', 'Ben', 'Joana', 'Fillip']
namesFromApi.map(el => {
object.names = [names, el]
})
In addition, how can a new name be added to the newly created array using a string value?