
Use typeof
to check if a value is classified as a string primitive. Only works for string primitives.
const isString = val => typeof val === 'string';
// Example
isString('10'); // true
Source
https://www.30secondsofcode.org/js/s/is-string