Navigate back to the homepage

How do you make a string empty in javascript?

Infinitbility
JavaScript
October 8th, 2022 · 1 min read

Hi Friends 👋,

Welcome To Infinitbility! ❤️

To make a string empty in javascript, assign the "" empty string to the variable. it will remove the previous value and store a new value which is a string.

Today, I’m going to show you How do I make a string empty in javascript, as mentioned above, I’m going to create a sample string variable then I will assign an empty string to make the string variable empty.

Let’s start today’s tutorial on how do you make a string empty in javascript.

Javascript makes a string empty

Here, we will do

  1. Create a sample string variable with data.
  2. assign an empty string to the variable
1// Create sample string variable with data.
2let str = "infintbility";
3
4console.log("Result 1: ", str)
5
6// assign an empty string to the variable
7str = "";
8
9console.log("Result 2: ", str)

Output

I hope it helps you, All the best 👍.

Follow me on Twitter

Join our email list and get notified about new content

No worries, I respect your privacy and I will never abuse your email.

Every week, on Tuesday, you will receive a list of free tutorials I made during the week (I write one every day) and news on other training products I create.

Looking For React Native Tutorial?

we are trying to create the best Tutorial for react native developers.

When you want a daily updates about React Native Tutorial or infinitbility update subscribe to our newsletter.

Read React Native Tutorial

Request New Tutorial or Article on mail [email protected]

Guide book

Guidebook: The Javascript Monorepo Photoshop Guide

Tutorials

Categories

More articles from Infinitbility

how do you check if a string is a string in Javascript?

An example of check if a string is a string in javascript with the step-by-step guide.

October 7th, 2022 · 1 min read

how to check if a string is an number Javascript?

An example of check string is a number or not in javascript with the step-by-step guide.

October 6th, 2022 · 1 min read
© 2020–2022 Infinitbility
About
Link to $https://medium.com/infinitbilityLink to $https://www.facebook.com/InfinitbilityLink to $https://github.com/infinitbilityLink to $https://twitter.com/infinitbilityLink to $https://www.buymeacoffee.com/infinitbilityLink to $mailto:[email protected]