Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
158
rated 0 times [  160] [ 2]  / answers: 1 / hits: 27693  / 16 Years ago, sun, february 8, 2009, 12:00:00

Hey all, I am trying to test if the argument passed into my function is a class name so that I may compare it to other classes using instanceof.



For example:



function foo(class1, class2) {
// Test to see if the parameter is a class.
if(class1 is a class)
{
//do some kind of class comparison.
if(class2 is a class)
{
if(class1 instanceof class2)
{
//...
}
}
else
{
//...
}
}
else
//...
}


Is this possible? I am having trouble googleing an answer.


More From » javascript

 Answers
There are no answers for this question yet.
Only authorized users can answer the question. Please sign in first, or register a free account.
devonw

Total Points: 311
Total Questions: 116
Total Answers: 111

Location: Senegal
Member since Fri, Aug 21, 2020
4 Years ago
;