Answers for "how to convert boolean to string in js"

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
3

string to boolean javascript

let toBool = string => string === 'true' ? true : false;
// Not everyone gets ES6 so here for the beginners
function toBool(string){
	if(string === 'true'){
      return true;
    } else {
      return false;
    }
}
Posted by: Guest on November-25-2020

Code answers related to "how to convert boolean to string in js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language