string.concat
๋งค๊ฐ๋ณ์๋ก ์ ๋ฌ๋ฐ์ ๋ชจ๋ ๋ฌธ์์ด์ ๋ฌธ์์ด๊ณผ ์ฐ๊ฒฐํ์ฌ ์ ๋ฌธ์์ด์ ๋ฐํํ๋ค.
const str1 = "Hello";
const str2 = "world";
console.log(str1.concat(' ', str2)); // Hello worldSyntax
str.concat(str2 [, ...strN])Parameters
str2, [, ...strN]
str์ ์ฐ๊ฒฐ์ํฌ String
Return Value
์ ๊ณต๋ ๋ฌธ์์ด์ ์กฐํฉํ ์๋ก์ด ๋ฌธ์์ด
Description
์๋ก์ด ๋ฌธ์์ด์ ๋ฐํํ๊ธฐ ๋๋ฌธ์ ์๋ณธ ๋ฌธ์์ด ๋ณํ๋๊ฑฐ๋ ์ํฅ์ ๋ผ์น์ง ์๋๋ค. ๋ฌธ์์ด์ ๋ถ๋ณ ๊ฐ Immutable.. ์ธ์์ ๊ฐ์ type string์ด ์๋๋ฉด ์ฐ๊ฒฐ์ํค๊ธฐ ์ ์ ๋ฌธ์์ด์ ๋ฐํํ๋ค.
Performance
concat() ๋ฉ์๋ ๋์ ์ ํ ๋น ์ฐ์ฐ์ ("+", "+=")๋ฅผ ์ฌ์ฉํ๋๊ฒ์ด ๊ฐ๋ ฅํ ๊ถ์ฅํ๋ค.
ํ ๋น ์ฐ์ฐ์๊ฐ ๋ ๋น ๋ฅด๋ค.
Examples
Last updated
Was this helpful?