How to check undefined in Typescript

前端 未结 9 977
面向向阳花
面向向阳花 2021-02-04 23:05

I am using this code to check undefined variable but it\'s not working.

9条回答
  •  南笙
    南笙 (楼主)
    2021-02-04 23:58

    It actually is working, but there is difference between null and undefined. You are actually assigning to uemail, which would return a value or null in case it does not exists. As per documentation.

    For more information about the difference between the both of them, see this answer.

    For a solution to this Garfty's answer may work, depending on what your requirement is. You may also want to have a look here.

提交回复
热议问题