I am defining a class in javascript using this...
// file_a.js
function class_a() {
this.prop1 = null;
this.prop2 = null;
}
// file_b.js
var obj = new class_a;
// I need to check here if class_a exists
How can I do this?
Regards
I am defining a class in javascript using this...
// file_a.js
function class_a() {
this.prop1 = null;
this.prop2 = null;
}
// file_b.js
var obj = new class_a;
// I need to check here if class_a exists
How can I do this?
Regards
if (typeof class_a === 'function')
class_a will be undefined so typeof class_a will be the string 'undefined', so the === test will evaluate as false which is the correct answer. It works perfectly.