본문 바로가기

프로그래머스(코딩 테스트)/Lv.0

특수문자 출력하기

 

// javascript
const solution = (specialSymbol) => {
    return specialSymbol; 
}

console.log(solution("!@#$%^&*(\\'\"<>?:;"));

 

//typescript
const solution = (specialSymbol: string): string => {
    if (typeof specialSymbol !== 'string') throw new Error('Input must be a string');

    return specialSymbol;
}
const input: string = "!@#$%^&*(\\'\"<>?:;";
console.log(solution(input));

 

 

'프로그래머스(코딩 테스트) > Lv.0' 카테고리의 다른 글

머쓱이보다 키 큰 사람  (0) 2024.10.15
두 수의 차  (0) 2024.10.15
두 수의 합  (0) 2024.10.15
더 크게 합치기  (0) 2024.10.15
홀짝에 따라 다른 값 반환하기  (0) 2024.10.15