📜  如何在 JavaScript 中测试变量是否具有值? - Javascript代码示例

📅  最后修改于: 2022-03-11 15:04:33.234000             🧑  作者: Mango

代码示例1
if (typeof variable == "undefined") {...} --> return true if variable undefined

//An empty string evaluates to FALSE in JavaScript so you can just do:
if (variable) {...}