Hi Abimaran, You could check [1] for different options. Check the answer where they are prioritized based on performance.
[1] http://stackoverflow.com/questions/263965/how-can-i-convert-a-string-to-boolean-in-javascript/28588344#28588344 Thanks, Himasha On Tue, Mar 10, 2015 at 11:03 AM, Abimaran Kugathasan <[email protected]> wrote: > Hi, > > I have a query string parameter with value true or false. I need to > convert this value to corresponding boolean value for some conditional > checking. > > Currently, I'm using string comparision with == to evaluate. > > var isPassiveAuthRequired = request.getParameter("passiveAuthRequired"); > > if('true' == isPassiveAuthRequired) { > // > } > > This doesn't look a proper way. I tried Boolean(isPassiveAuthRequired), > but it returns false even for value 'true'. > > Anybody knows a better way? > > -- > Thanks > Abimaran Kugathasan > > Software Engineer | WSO2 Inc > Data & APIs Technologies Team > Mobile : +94 773922820 > > <http://stackoverflow.com/users/515034> > <http://lk.linkedin.com/in/abimaran> > <http://www.lkabimaran.blogspot.com/> <https://github.com/abimaran> > <https://twitter.com/abimaran> > > > _______________________________________________ > Dev mailing list > [email protected] > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- Himasha Guruge *Software Engineer* WS*O2* *Inc.* Mobile: +94 777459299 [email protected]
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
