JS_LooselyEqual 编辑
This article covers features introduced in SpiderMonkey 1.8.1
Determine whether two JavaScript values are equal in the sense of the == operator
.
Syntax
bool
JS_LooselyEqual(JSContext *cx,
JS::Handle<JS::Value> v1, JS::Handle<JS::Value> v2,
bool *equal);
Name | Type | Description |
---|---|---|
cx | JSContext * | The context in which to perform the conversion. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext . |
v1 , v2 | JS::Handle<JS::Value> | The value to compare. |
equal | bool * | Out parameter. Receives the comparison result. |
Description
JS_LooselyEqual
determines if v1
is loosely equal to v2
under the JavaScript ==
operator, as specified in ECMA 262-3 §11.9.3. If the comparison attempt was successful, the method returns JS_TRUE
and stores the result in *equal
; otherwise it returns JS_FALSE
.
Comparing jsval
s directly in C++, as in v1 == v2
, does not produce a meaningful result, since it is possible for two distinct JSString
s or jsdouble
s to represent the same string or number.
See Also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论