DEV Community

Discussion on: Daily Challenge #310 - Boolean to String Conversion

Collapse
 
raphaelchaula profile image
Raphael Chaula

JavaScript

const booleanToString = (value) => {
    return JSON.stringify(value);
};

const booleanValue = true;
const itsStringValue = booleanToString(booleanValue);
Enter fullscreen mode Exit fullscreen mode
Collapse
 
mellen profile image
Matt Ellen-Tsivintzeli

That's pretty heavyweight! value.toString() works, too.

Collapse
 
raphaelchaula profile image
Raphael Chaula

Yes, mine is really really heavy, just tried something no one could think of.