I have a method that receives something and it needs to determine the type of the received value. I can use the typeof
thing to perform regular comparisons like if it is a number or a string. But how can I do this for JSON objects? Comparing them with JSON
brings up the error:
Uncaught TypeError: Expecting a function in instanceof check, but got #< Object>
So I guess that comparing a JSON object type with JSON
is not the way?
The original code is like:
check = (what) ->
if what instanceof JSON
alert "Yooo"
check({compare: "me"})