How do I check for the existence of a variable
This question already has an answer here:
Just use typeof
:
console.log(typeof FooClass) // undefined
console.log(typeof FooClass === 'undefined') // true
I doubt there's any need to use language features specific to TypeScript.
链接地址: http://www.djcxy.com/p/95014.html上一篇: JavaScript检查变量是否存在(已定义/初始化)
下一篇: 我如何检查变量的存在