Sometimes, we want to convert a boolean a to string value with TypeScript.
In this article, we’ll look at how to convert a boolean a to string value with TypeScript.
How to convert a boolean a to string value with TypeScript?
To convert a boolean a to string value with TypeScript, we can use the String
function.
For instance, we write
const myBool: boolean = true;
const myString: string = String(myBool);
to call String
with myBool
to return myBool
converted to a string.
Conclusion
To convert a boolean a to string value with TypeScript, we can use the String
function.