javascript check if string or object code example
Example 1: js test if string
if (typeof string === 'string') { /* code */ };
Example 2: javascript is variable a string
if (typeof myVar === 'string'){
//I am indeed a string
}
if (typeof string === 'string') { /* code */ };
if (typeof myVar === 'string'){
//I am indeed a string
}