[Edit]
+
0
-
0
js convert string to boolean
1 2 3 4 5 6 7 8 9 10 11 12 13function parseBoolean(text) { var value = JSON.parse(text); if(typeof value != 'boolean') throw new Error('Incorrect type!'); return value; } var text = 'true'; var value = parseBoolean(text); console.log(value);