If you want to find type of students object property like name and marks you can get them as following,
Now go ahead and fetch type of calculateGrades.
You will get expected output as following,
If you slightly modify above code as below you will get undefined as output. We have put braces in finding type of function
While reflecting getting these two values as output may not be good idea
You may want to avoid these values in your code or can use other method hasOwnProperty . You can use this method to find that whether object contains that particular property or not. Following code will alert True since name is property of object Student.
Now let us go ahead and pass function name calculateGrades as value to hasOwnProperty. You will find true as output again.
Interestingly in above code you see that when we pass constructor as input output is false. Reason behind this is hasOwnProperty method does not look for the method in whole property chain. It will only look for the input parameter in current object. As clearly we see that Student object does not have constructor property of its own hence hasOwnProperty is giving false for this.
I hope you find this post useful. Thanks for reading.