# TypeScript function 傳入自定義字串 使用 enum: function ```jsx // 如果需要傳入自訂的字串 enum CARDTYPE { I = 'I', R = 'R', } function squareOf(idNumber: string, type: CARDTYPE): boolean { console.log(idNumber) return type === 'R' || false } squareOf('A123', CARDTYPE.I) ``` 使用 type ```typescript type CARDTYPE = 'I' | 'R' function squareOf(idNumber: string, type: CARDTYPE): boolean { console.log(idNumber) return type === 'R' || false } squareOf('A123',"") ``` 輸入 "" 時,會出現 select 面板唷 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up