연간 연간 결제 시 모든 유료 요금제에서 2개월 무료. 요금제 보기
로그인 무료로 시작

코드 번역

입력
코드
function add(a, b) { return a + b; }
예시 결과 27 10월 2026에 생성됨

export function add(a: number, b: number): number { return a + b; }

Notes:

  • The TypeScript version explicitly accepts and returns number.
  • Unlike the JavaScript original, calls with strings or other non-number values are rejected at compile time.
  • TypeScript types are erased at runtime, so JavaScript callers can still pass incompatible values unless runtime validation is added.
  • number includes floating-point values, NaN, and Infinity.
  • JavaScript’s usual numeric behavior still applies, including floating-point precision issues and coercion at runtime.
이걸로 시작 코드 번역 이 예시의 입력이 채워진 채로 양식이 열립니다. 무엇이든 바꿀 수 있어요.