Checks if the given value is a string.

Type signature

(x?: any) => boolean

Examples

string("Test");
// ⇒ true
Try in REPL
string(["T", "e", "s", "t"]);
// ⇒ false
Try in REPL

Questions

  • How to check if a given value is a string?

TypeScript sourceJavaScript source