Skip to content
เข้าสู่ระบบ

Null Handling

TypeScript มี strict null checking ที่ช่วยป้องกัน null/undefined errors ด้วย operators และ patterns ต่างๆ

วิธีSyntaxใช้เมื่อ
Optional Chaining?.เข้าถึง nested properties
Nullish Coalescing??ใช้ค่า default
Non-null Assertion!แน่ใจว่าไม่ null
Type Narrowingif (x)ตรวจสอบก่อนใช้
Diagram

เข้าสู่ระบบเพื่อดูเนื้อหาเต็ม

ยืนยันตัวตนด้วยบัญชี Google เพื่อปลดล็อกบทความทั้งหมด