TypeScript
[TypeScript] 단축 구문(shorthand) - {a:a, b:b} = {a, b}
SunPark
2021. 6. 24. 23:43
단축 구문(shorthand)는 매개변수와 변수의 이름이 똑같은 경우 속성값의 부분을 생략하여 사용
const hi = (a: string, b: string) => {
return {a, b} // {a: a, b: b}
}
console.log("hello", "world"); // {"a": "hello", "b": "world"}
반응형