JavascriptMVC的assertEqual函数是什么?

发布于 2024-12-26 05:05:57 字数 380 浏览 3 评论 0原文

我对 JavascriptMVC 完全是菜鸟,所以我正在阅读教程。但我不得不说一些我确信非常简单的事情却让我完全困惑。在他们的一些教程中,他们引用了函数 assertEqual()。每当我尝试在开发环境中运行它时,我的调试工具都会告诉我它找不到 assertEqual 函数。我缺少什么?以下是使用 assertEqual 的示例链接:

http:// /javascriptmvc.com/docs.html#!mvc.class

对它的第一个引用位于实例化子标题下的代码中。谢谢!

I'm a total noob to JavascriptMVC so I'm going through the tutorials. But I have to say something that I'm sure is very simple is totally confusing me. In some of thier tutorials they reference a function assertEqual(). Whenever I try to run this in a dev environment my debug tools tell me it can't find the assertEqual function. What am I missing? Here's a link to an example of where they use assertEqual:

http://javascriptmvc.com/docs.html#!mvc.class

The first reference to it is in the code under the Instantiation sub heading. Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

忘你却要生生世世 2025-01-02 05:05:57

他们只是写了不好的例子。它应该说明某物与另一物相等。

assertEqual 的简单实现是

function assertEqual(a, b) {
  if (a !== b) {
    throw new Error('values are not equal');
  }
}

They are just writing bad examples. It's supposed to illustrate that something is equal to something else.

A naive implementation of assertEqual would be

function assertEqual(a, b) {
  if (a !== b) {
    throw new Error('values are not equal');
  }
}
心碎无痕… 2025-01-02 05:05:57

我访问了该链接——我认为它是文档中的拼写错误。尝试 assertEqual

I visited the link -- I think its a typo in the documentation. Try assertEqual.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文