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

특수문자 출력하기

걍가영 2024. 10. 15. 14:05

 

// 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));