How can I split an object like ["text1 text2"] to only show the text1 text2 string in javascript?
2 Answers
As Tibrogargan said in the comments above, ["text1 text2"] is an array. This array contains one string value "text1 text2" which can be accessed either by using it's index inside an array (to get that specific item) or by looping through all the items inside the array (if you want all items).
For your case, it's easy to use index.
var stringArray = ["text1 text2"];
console.log(stringArray[0]);
// text1 text2 should be logged into console
Check here for more documentation.
["text1 text2"]is an Array, not a String. It doesn't have asplit()method