Reputation: 227
I've tried assigning different data types such as boolean, numbers, strings, objects, nulls, etc, but keep getting false returned. Any ideas?
Upvotes: 6
Views: 215
Reputation: 303253
The typeof
operator always returns a string value. As such, your original value must be a string. The result of typeof
for a string is "string"
, and so:
x = "string"
typeof x === x // true
Upvotes: 15