JS中有效判断一个值是否是 null 或 undefined

上代码:

 if ( some_variable == null ){
   // some_variable is either null or undefined
 }

更多代码:

if ( !some_variable ) {
  // some_variable is either null, undefined, 0, NaN, false, or an empty string
}

你可能感兴趣的:(nodejs,Javascript)