javascript - 为什么instanceof Map返回false?

标签 javascript draftjs draft-js-plugins

我正在使用 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 。

enter image description here

最佳答案

当您编写instanceof Map时,它指的是 native Map 。我挖掘了Draft.js source code (第 2 行)并发现他们使用 this library 中不同类型的 map 。所以当你比较它们时,它们并不相同。

关于javascript - 为什么instanceof Map返回false?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47373596/

相关文章:

reactjs - Draft.js 编辑器为空

javascript - 如何在 react-draft-wysiwyg 中添加自定义下拉菜单?

javascript - 无法在 Draft.js 中垂直调整图像大小

reactjs - Draft-js-export-html 导出时不包含视频

Javascript 新手 : Array. isArray() 查询

javascript - JS 预加载图片错误

javascript - 用铁刷新Meteor页面 :router always clears route

javascript - 获取特定格式的日期/时间戳

javascript - DraftJs:使用实体键替换实体

reactjs - Draft.js (react-draft-wysiwyg) : text update from the outside of the Editor component does not work