我正在file1.js中创建所示的Feature Object,并将其作为参数传递给另一个文件file2.js中存在的函数
const f = new Feature();
console.log(f instanceof Feature) //returns true;
const data = encodeDatatoJson (f);
相反,当此“ f”到达file2.js时,instanceof返回false。
const jsonData = {};
encodeDatatoJson = (f) => {
if(f instanceof Feature){ //returns false;
jsonData.f.push(geoJSON.writeFeatureObject(f));
}
}
可能是什么原因。