Ning Ma blog

my technology tips

April, 2016

using underscore to verify if a variable is undefined or null

Example of if a variable is undefined

Example of if a variable is null function test() { var foo = null; console.log(_.isNull(foo)); // true, var foo = 3; console.log(_.isNull(foo)); // false, }