How to check if a variable is a string in JavaScript?
Originally Published Here ๐!
To check if a variable is a string, you can use the typeof operator followed by the variable or expression in JavaScript.
// Check if variable is a string
const str = "Hello World!";
typeof str; // string
The operator...
melvingeorge-me.hashnode.dev1 min read