Answers for "reasons why boolean convert into string javascript"

3

javvascript convert boolean to string

// To convert a boolean to a string we use the .toString() method
let isValid = true;

console.log(isValid.toString()); // outputs "true"
console.log(isValid); // outputs true
Posted by: Guest on March-08-2020
-1

How can I convert a string to boolean in JavaScript?

ES6+
const string = "false"
const string2 = "true"

const test = (val) => (val === "true" || val === "True")
console.log(test(string))
console.log(test(string2))
Posted by: Guest on March-15-2022

Code answers related to "reasons why boolean convert into string javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language