我正在使用这个在 javascript 中定义一个类...
// 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
我该怎么做?
问候
最佳答案
if (typeof class_a === 'function')
关于javascript - 如何检查javascript中的类是否存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4314084/