How to convert a boolean string to boolean value in JavaScript

2 Answers

0 votes
var s = 'True';

var b = (s == 'True');

document.write(b);
        

/*

run:

true

*/

 



answered Feb 26, 2017 by avibootz
0 votes
var s = 'False';

var b = !(s == 'False');

document.write(b);
        

/*

run:

false 

*/

 



answered Feb 26, 2017 by avibootz

Related questions

...