To create an empty string in JavaScript, you can initialize a variable with an empty string literal.
In this example,
emptyString
and initialize it with an empty string literal ''
.emptyString
now holds an empty string.let emptyString = '';
console.log(`Empty string created: '${emptyString}'`);
Empty string created: ''
In this tutorial, we learned How to Create an Empty String in JavaScript language with well detailed examples.