if something === string javascript code example
Example 1: if string javascript
if (typeof myVar === 'string') { /* code */ };
Example 2: if is a string javascript
function isString(x) {
return Object.prototype.toString.call(x) === "[object String]"
}