SyntaxFix
Write A Post
Hire A Developer
Questions
typeof(text) === 'string' || text instanceof String;
you can use this, it will work for both case as
var text="foo"; // typeof will work
var text="foo";
String text= new String("foo"); // instanceof will work
String text= new String("foo");