선택적매개변수 썸네일형 리스트형 [Typescript] 선택적 매개변수 사용 방법 - 매개변수 뒤에 물음표 함수의 매개변수에 물음표를 붙임으로써 매개변수를 선택적으로 사용 // case 1 function hi(a: string, b?: string) { console.log(a, b); } add("hello", "world!")// hello world! add("hello")// hello undefined // case 2 const hi => (a: string, b?: string) { console.log(a, b); } add("hello", "world!")// hello world! add("hello")// hello undefined 더보기 이전 1 다음