MDN wants to learn about developers like you:


This article covers features introduced in SpiderMonkey 17

Convert any JavaScript value to a boolean.


JS::ToBoolean(JS::HandleValue v)
Name Type Description
v JS::HandleValue The value to convert.


JS::ToBoolean converts a JavaScript value to a boolean. It implements the ToBoolean operation described in ECMA 262-3 §9.2. This function can not fail and the return value is always the boolean conversion of the argument.

Document Tags and Contributors

 Contributors to this page: arai, evilpie
 Last updated by: arai,