Also, the statement
"Socrates" === "man"
is false for the same reason.
What you're seeking is
anyfunc instanceof Function
Function
is classified as a class in JavaScript. Classes in JavaScript behave similarly to variables.
This leads to the intriguing question of what type "Function" actually is. In most languages, it would be considered a "Class". However, in JavaScript, classes are essentially functions, which adds complexity. In this case, Function instanceof Function
evaluates to true!
In other languages, "Class" would be an instance of itself (the object representing the class is an object deriving from Class). In contrast, due to JavaScript's implementation of classes as functions, determining the answer to your query becomes challenging.
Remember that somefunc !== Function
. These are distinct variables with different values. However, somefunc instanceof Function
.