我正在使用 Draft.js 插件 Mention .
对于 editorState.content.entityMap.mention
,我可以通过以下方式成功获取值
mention.get('address')
但是为什么我检查它是否是Map
by
console.log('mention', mention);
console.log('mention instanceof Map', mention instanceof Map);
它返回false
?请注意,控制台显示提及
是 map 。
最佳答案
当您编写instanceof Map时,它指的是 native Map 。我挖掘了Draft.js source code (第 2 行)并发现他们使用 this library 中不同类型的 map 。所以当你比较它们时,它们并不相同。
关于javascript - 为什么instanceof Map返回false?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47373596/