Returns true if object is a String (official Underscore docs). Primitives like "moe", empty strings, and boxed new String() pass; numbers and objects do not. Stable helper — not deprecated.
Pass the required arguments shown below. Underscore object helpers usually return a new value — check whether the source object is mutated.
Syntax
Call _.isString. Start with this line.
Underscore
_.isString(object)
Call
What it does
_.isString(object)
Primary signature.
_.isString(...)
Call with the arguments your case needs.
Load Underscore with import _ from "underscore" (or the UMD CDN build) so these helpers are available as _.
Library declarations
Underscore
_.isString(object)
Parameters
Parameter
Description
object
Required. Value to test
Return Value
Return Value
Description
*
true or false
Underscore.js Examples
Example 1 — Official: "moe"
The docs check Underscore’s classic sample string.
Guard first. Skip non-strings so .trim() never throws.
String path. Trim whitespace from real text → "moe".
Fail closed. Numbers and null return an empty string.
Pattern. Type-check → then call string methods.
Compatibility
Browser & Runtime Support
_.isString ships with Underscore.js (1.x). It runs anywhere Underscore runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install underscore.
✓ Stable · Underscore 1.x
_.isString()
Available in [email protected] (UMD / ESM). Works in evergreen browsers and current Node LTS when Underscore is loaded.
100%With Underscore 1.x
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
_.isStringUnderscore 1.x+
Bottom line: Safe for production once Underscore is on the page or in your bundle. Not a native browser API — load Underscore first. Prefer a pinned CDN version (e.g. [email protected]).
Frequently Asked Questions
_.isString(object) returns true when the value is a String — a primitive such as "moe", an empty string, a template literal, or a boxed new String() object. Numbers, arrays, objects, and null return false.
_.isString("moe") returns true. moe is Underscore’s classic sample string, so the docs use it to show a real String passing the check.
Yes. "" is still a String. isString answers type, not length. Pair it with _.isEmpty if you also need to reject blanks.
typeof "moe" === "string" agrees for primitives. typeof new String("moe") is "object", so typeof misses boxed strings. Underscore’s tag check accepts both forms.
Use it as a guard before calling string methods like split, trim, or toUpperCase, or when an API value might be text, a number, or null.
No. It is a stable Underscore type helper. Load Underscore 1.x (CDN or npm) and call _.isString(value).