How to check undefined in Typescript

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

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

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

    You can just check for truthy on this:

    if(uemail) {
        console.log("I have something");
    } else {
        console.log("Nothing here...");
    }
    

    Go and check out the answer from here: Is there a standard function to check for null, undefined, or blank variables in JavaScript?

    Hope this helps!

提交回复
热议问题