[๐Ÿฑ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ] ๋ฐฐ์—ด/๋ฌธ์ž์—ด ํ•ฉ์น˜๊ธฐ - concat ๋ฉ”์„œ๋“œ

dsfasdยท2022๋…„ 9์›” 20์ผ
0

concat ๋ฉ”์„œ๋“œ ์‚ฌ์šฉ๋ฒ•

concat ๋ฉ”์„œ๋“œ๋Š” ๋‘ ๊ฐœ์˜ ๋ฐฐ์—ด / ๋ฌธ์ž์—ด์„ ํ•˜๋‚˜๋กœ ํ•ฉ์ณ์ค€๋‹ค.

๊ธฐ๋ณธ ํ˜•ํƒœ

๋ฐฐ์—ด1.concat(๋ฐฐ์—ด2)

๋ฌธ์ž์—ด1.concat(๋ฌธ์ž์—ด2)

์˜ˆ์ œ

๋ฐฐ์—ด

let nums = [1,2,3,4,5]
let nums2 = [6,7,8,9,10]
let concatNums = nums.concat(nums2)
console.log(concatNums)
// [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

๋ฌธ์ž์—ด

let stirng1 = 'hi'
let stirng2 = 'Hello'
let concatString = stirng1.concat(stirng2)
console.log(concatString)
// hiHello
profile
๊ธฐ๋ก์„ ์ •๋ฆฌํ•˜๋Š” ๊ณต๊ฐ„!

0๊ฐœ์˜ ๋Œ“๊ธ€