์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์•Œ๊ณ ๋ฆฌ์ฆ˜

[์ธํ”„๋Ÿฐ ์„น์…˜5] ๋‘ ๋ฐฐ์—ด ํ•ฉ์น˜๊ธฐ (Javascript)

์€์ง„ 2021. 6. 25. 12:51

์ธํ”„๋Ÿฐ

๐Ÿ‘ฉ๐Ÿป‍๐Ÿ’ป๋ฌธ์ œ๋งํฌ

[์ธํ”„๋Ÿฐ ์„น์…˜5] ๋‘ ๋ฐฐ์—ด ํ•ฉ์น˜๊ธฐ (Javascript)
์œ ๋ฃŒ ๊ฐ•์˜์ธ ๊ด€๊ณ„๋กœ ๋ฌธ์ œ ์„ค๋ช…์€ ์ƒ๋žตํ•ฉ๋‹ˆ๋‹ค.

 

โœ๏ธIdea Sketch

2021-06-25

1. […arr1, …arr2] ๋ฐฐ์—ด ํ•ฉ์น˜๊ธฐ

2. sort((a, b) => a-b) ๋ฐฐ์—ด ์ •๋ ฌ

 

โœ๏ธ์†Œ์Šค์ฝ”๋“œ

2021-06-25

function solution(arr1, arr2) {
  return [...arr1, ...arr2].sort((a, b) => a-b)
}