JS_StrictlyEqual 编辑
This article covers features introduced in SpiderMonkey 1.8.1
Determine whether two JavaScript values are equal in the sense of the === operator
.
Syntax
// Added in SpiderMonkey 45 bool JS_StrictlyEqual(JSContext *cx, JS::Handle<JS::Value> v1, JS::Handle<JS::Value> v2, bool *equal); // Obsolete since JSAPI 39 bool JS_StrictlyEqual(JSContext *cx, jsval v1, jsval 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> / jsval | The value to compare. |
equal | bool * | Out parameter. Receives the comparison result. |
Description
JS_StrictlyEqual
determines if v1
is strictly equal to v2
under the JavaScript ===
operator, as specified in ECMA 262-3 §11.9.6. If the comparison attempt was successful, the method returns true
and stores the result in *equal
; otherwise it returns 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论