admin管理员组文章数量:1295295
How to validate if a parameter is exits in the querystring or not in the node.js ?
I am validating like this
if(prm1 == null)
return error
But actually in the console.log(prm1) says undefined..
How to validate this exactly ?
How to validate if a parameter is exits in the querystring or not in the node.js ?
I am validating like this
if(prm1 == null)
return error
But actually in the console.log(prm1) says undefined..
How to validate this exactly ?
Share asked Apr 5, 2013 at 12:44 RajRaj 8374 gold badges15 silver badges24 bronze badges 1- try if(prm), it exists, or if(!prm) it doesnot exist – Xavier S. Commented Apr 5, 2013 at 12:59
1 Answer
Reset to default 6If the parameter is not present in your queryString it is returned as undefined
. The parameter wouldn't return null
because it wasn't initialised.
try this :
if(typeof prm1 != 'undefined')
return "error";
本文标签: javascripthow to check if a parameter is present in the querystring in nodejsStack Overflow
版权声明:本文标题:javascript - how to check if a parameter is present in the querystring in node.js - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741615593a2388507.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论