Why am I getting an error when I use `typeof`?


#1

Question

Why am I getting an error when I use typeof?

Answer

The typeof operator returns a data type in string format, so you if you want to make a comparison, make sure your expected data type is also in string format.