Files
30-seconds-of-code/js/s/is-string.md
Angelos Chalaris 5c913d20bd Reorganize snippets
2023-05-03 21:19:02 +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