![article thumbnail image](https://blog.kakaocdn.net/dn/bBxKhE/btrLuw6Ujhh/RXRJjnlb69nX1Zk6Uk3tok/img.jpg)
node 출력방식대신 script 로 출력하였습니다.
문자열을 합치는 문제이다.
📌입력코드
<script>
function solution(str) {
let answer = '';
answer = str + '??!';
return answer;
}
console.log(solution('Joonas'))
</script>
매우 간단하게 + 연산자를 사용하면 된다.
concat메소드를 활용해도 된다.
<script>
function solution(str) {
let answer = '', str2 = '??!';
answer = str.concat(str2)
return answer;
}
console.log(solution('Joonas'))
</script>
'알고리즘 > 백준' 카테고리의 다른 글
[Javascript] 9498번 - 시험 성적 (0) | 2022.09.09 |
---|---|
[Javascript] 2588번 - 곱셈 (0) | 2022.09.07 |
[Javascript] 10430번 - 나머지 (0) | 2022.09.06 |
[Javascript] 3003번 - 킹, 퀸, 룩, 비숍, 나이트, 폰 (0) | 2022.09.06 |
[Javascript] 10869번 - 사칙연산 (0) | 2022.09.05 |