Home >Web Front-end >JS Tutorial >How to define a variable in js and determine whether it is empty_javascript skills

How to define a variable in js and determine whether it is empty_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:48:291378browse

Define a variable var params=null in js; the method to determine if params is not empty:

Copy code The code is as follows:

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

Where: console.info(params);//The result is: Object {}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn