Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ca3c147

Browse files
committed
Add a question
1 parent 8031411 commit ca3c147

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

‎README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1925,3 +1925,31 @@ const wave = str => {
19251925
---
19261926

19271927
**[⬆ Back to Top](#javascript-coding-challenges-for-beginners)**
1928+
1929+
## 56. Concatenation of Array
1930+
1931+
Write a function that given an integer array `nums` of length `n`, returns an array of length `2n` where `nums` is concatenated to itself.
1932+
1933+
```js
1934+
const getConcatenation = nums => {
1935+
// Your solution
1936+
};
1937+
1938+
console.log(getConcatenation([1, 2, 3])); // [1, 2, 3, 1, 2, 3]
1939+
console.log(getConcatenation([4, 3, 2, 1])); // [4, 3, 2, 1, 4, 3, 2, 1]
1940+
1941+
```
1942+
1943+
<details><summary>Solution</summary>
1944+
1945+
```js
1946+
const getConcatenation = nums => {
1947+
return [...nums, ...nums];
1948+
};
1949+
```
1950+
1951+
</details>
1952+
1953+
---
1954+
1955+
**[⬆ Back to Top](#javascript-coding-challenges-for-beginners)**

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /