check variable is string javascript code example
Example 1: if string javascript
if (typeof myVar === 'string') { /* code */ };
Example 2: javascript is variable a string
if (typeof myVar === 'string'){
//I am indeed a string
}
Example 3: javascript check if var is string
if (typeof a_string === 'string') {
// this is a string
}