javascript - 框架在javascript中是什么意思?

标签 javascript

我正在阅读《可维护的 JavaScript》这本书。在书中,作者谈到了框架,需要帮助才能理解这意味着什么。

Passing arrays back and forth between frames was one of the original cross-frame issues in JavaScript. Developers quickly discovered that instanceof Array didn’t always produce appropriate results in these cases. As mentioned previously, each frame has its own Array constructor, so an instance from one frame isn’t recognized in another. Douglas Crockford first recommended performing some duck typing, testing for the presence of the sort() method:

// Duck typing arrays
function isArray(value) {
  return typeof value.sort === "function";
}

最佳答案

这是指 HTML <frame> element , 或 the modern <iframe>

重点是帧之间,Array单独创建,你不能做 instanceof在一个框架(可能是主文档)中创建的数组与在 <iframe> 中创建的数组之间的比较的代码。

关于javascript - 框架在javascript中是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15227961/

相关文章:

javascript - 使用 jquery 从 iframe 更新父级

javascript - 如何让 MutationObserver 多次工作?

javascript - 使用socket.io加入房间后如何获得其他用户的响应

javascript - JSX:什么时候计算 JavaScript 表达式?

javascript - 非常风格的 CSS 巨型菜单

javascript - 使用 Lodash 拔取嵌套对象的键

javascript - jquery 旋转图像并用同名文件保存它们(覆盖)?

javascript - 使用 JavaScript 在窗口/选项卡之间进行通信

javascript - 使用 Jest 测试跨浏览器扩展,如何模拟 Chrome 存储 API?

javascript - 在子范围内调用回调的最佳方式是什么?