728x90
반응형
join() 함수는 배열의 모든 요소를 연결해 하나의 문자열로 만듭니다.
arr.join([separator])
- separator는 옵션입니다.
const str1 = ['Hello', 'world'].join();
const str2 = ['Hello', 'world'].join('♥');
document.write(str1);
document.write('<br>');
document.write(str2);
console.log(str1) => hello,world
console.log(str2) => hello♥world
728x90
반응형
'📁𝐩𝐫𝐨𝐠𝐫𝐚𝐦𝐦𝐢𝐧𝐠𝐋𝐚𝐧𝐠𝐮𝐚𝐠𝐞 > JavaScript' 카테고리의 다른 글
[메서드] filter() (0) | 2023.02.07 |
---|---|
[메서드] map() (0) | 2023.02.07 |
[메서드] split() (0) | 2023.01.30 |
[메서드] replace() (0) | 2023.01.30 |
[메서드] sort() (0) | 2023.01.30 |