if string in 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]"
}
if (typeof myVar === 'string') { /* code */ };
function isString(x) {
return Object.prototype.toString.call(x) === "[object String]"
}