how to check variable is string or not in javascript code example
Example 1: if string javascript
if (typeof myVar === 'string') { /* code */ };
Example 2: check data type in javascript
typeof("string"); //string
typeof(123); //number
if (typeof myVar === 'string') { /* code */ };
typeof("string"); //string
typeof(123); //number