Files
30-seconds-of-code/snippets/js/s/is-string.md
2023-05-07 16:07:29 +03:00

388 B

title, type, language, tags, cover, dateModified
title type language tags cover dateModified
Value is string snippet javascript
type
string
overgrown 2020-10-20T23:02:01+03:00

Checks if the given argument is a string. Only works for string primitives.

  • Use typeof to check if a value is classified as a string primitive.
const isString = val => typeof val === 'string';
isString('10'); // true