개발일지/Javascript
[JavaScript] 문자열
zzoo-ppaamm
2021. 7. 27. 16:03
반복되는 문자열 생성
const BLANK = "_";
const result = BLANK.repeat(number);
문자열 합치기
1. +연산
const a = "_";
const b = "+";
const c = "-";
const result = a + b + c;
2. list to string (join)
const a = "_";
const b = "+";
const c = "-";
const result = [];
result.push(a,b,c);
result.join("");
성능 비교
(1) 59175 ms vs (2) 220 ms
https://stackoverflow.com/questions/2087522/does-javascript-have-a-built-in-stringbuilder-class