Method in js that defines a variable and determines whether it is null


Var params=null; Method to determine if params is not null:


if(params && params.hasOwnProperty("name")){}

Among them: the console. The info (params); // result: Object {}