Navigate back to the homepage

how to check blank space in typescript?

Infinitbility
TypeScript
September 7th, 2022 · 1 min read
how to check blank space in typescript?

Hi Friends 👋,

Welcome To Infinitbility! ❤️

To check blank space in typeScript, use if...else statement with trim() method it will handle all falsy value like undefined, null, empty, blank and etc.

Let’s see short example to use if...else with trim() method to check blank space in in typeScript.

1if(value.trim()){
2
3}

Today, I’m going to show you How do I check blank space in typeScript, as above mentioned, I’m going to use the above-mentioned if...else statement.

Let’s start today’s tutorial how do you check blank space in typeScript?

TypeScript check blank space example

Here, we will take string variable with some data and use if...else statement to check blank space.

1let value: any = " ";
2
3if(value.trim()){
4 console.log("value is have data")
5} else {
6 console.log("value is a blank")
7}
8
9if(value.trim() == ""){
10 console.log("value is a blank")
11}

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 to check blank value in typescript?

how to check blank value in typescript?

An example of check blank value in typeScript with the step-by-step guide.

September 7th, 2022 · 1 min read
how to check array is undefined in typescript?

how to check array is undefined in typescript?

An example of check array is undefined in typeScript with the step-by-step guide.

September 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]