Convert a Char Array to a String
Use join
:
string = s.join("");
You do it this way:
var str = s.join();
The join command lets you set the token among the items in the array.
Ex1:
function print(str) {
$("#result").append("<p>" + str + "</p>");
}
print(["A", "B", "C"].join()); // "A,B,C"
print(["A", "B", "C"].join("-")); // "A-B-C"
print(["A", "B", "C"].join("||")); // "A||B||C"
print(["A", "B", "C"].join("")); // "ABC"
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="result"></div>
Or use String.
var string = String([1,2,3]);