Check if a variable isstring in JavaScript

Today, We want to share with you javascript isstring.In this post we will show you javascript typeof string, hear for javascript string contains we will give you demo and example for implement.In this post, we will learn about Remove Last Character From String Javascript with an example.

Check if a variable is a string in JavaScript

Example 1: js check if variable is string

if (typeof st_data === 'integer'){
    //We are indeed an integer
}

if (typeof st_data === 'boolean'){
    //We are indeed a boolean true/false
}

Example 2: is string javascript

function isString(value) {
	return typeof value === 'string' || value instanceof String;
}

isString(''); // true
isString(1); // false
isString({}); // false
isString([]); // false
isString(new String('teste')) // true

Example 3: if string javascript

if (typeof st_data === 'string') { /* code */ };

I hope you get an idea about type of boolean javascript.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment