How to apply to the array replace?

As in this case to use replace to an array given only the numbers?
And why the alert in this situation fails and all code that is written below, too?
var arrText = [1,2,3,4];
var sameText = arrText.replace(/,/g, "");
July 2nd 19 at 17:33
2 answers
July 2nd 19 at 17:35
Because the array is not the function replace. You probably want something like this?
var arrText = [1,2,3,4];
var sameText = arrText.toString().replace(/,/g, "");
July 2nd 19 at 17:37
var arrText = [1,2,3,4];
var sameText = arrText.join(")

Find more questions by tags JavaScript