In Javascript the use of typeof()
allows you to quickly see what type of anything is, what is the equivalent in the Crystal?
Say the code below I wanted to check what type Crystal thought the object was.
get "/" do
object = {hello: "hello", world: "world"}
object.to_json
puts typeof(object)
end
Sometimes google works wonders, I searched the API docs for typeof and found nothing.
It is just typeof() https://crystal-lang.org/reference/1.4/syntax_and_semantics/typeof.html