3311 shaares
1 private link
1 private link
Therefore I use either of the following two approaches if I need a special value:
- I use
null
as a “switched off” value. (As an aside, this approach is relatively well supported by TypeScript.)- I avoid both
undefined
andnull
via one of the techniques described above. This has the upside of being cleaner and the downside of involving more work.