Dev. Web/JavaScript Jquery
[JS] 배열 합치기, join 응용
devock
2019. 7. 4. 23:15
var buffer = {
entries : [],
add : function(s) {
this.entries.push(s);
},
concat : function() {
return this.entries.join("");
}
};
var source = ["867", "-", "5309"];
source.forEach(function(s) {
buffer.add(s);
});
buffer.entries.join("");
result : "867-5309"