1# Boolean 2 3Class `Napi::Boolean` inherits from class [`Napi::Value`][]. 4 5`Napi::Boolean` class is a representation of the JavaScript `Boolean` object. The 6`Napi::Boolean` class inherits its behavior from the `Napi::Value` class 7(for more info see: [`Napi::Value`](value.md)). 8 9## Methods 10 11### Constructor 12 13Creates a new empty instance of an `Napi::Boolean` object. 14 15```cpp 16Napi::Boolean::Boolean(); 17``` 18 19Returns a new _empty_ `Napi::Boolean` object. 20 21### Constructor 22 23Creates a new instance of the `Napi::Boolean` object. 24 25```cpp 26Napi::Boolean(napi_env env, napi_value value); 27``` 28 29- `[in] env`: The `napi_env` environment in which to construct the `Napi::Boolean` object. 30- `[in] value`: The `napi_value` which is a handle for a JavaScript `Boolean`. 31 32Returns a non-empty `Napi::Boolean` object. 33 34### New 35 36Initializes a new instance of the `Napi::Boolean` object. 37 38```cpp 39Napi::Boolean Napi::Boolean::New(napi_env env, bool value); 40``` 41- `[in] env`: The `napi_env` environment in which to construct the `Napi::Boolean` object. 42- `[in] value`: The primitive boolean value (`true` or `false`). 43 44Returns a new instance of the `Napi::Boolean` object. 45 46### Value 47 48Converts a `Napi::Boolean` value to a boolean primitive. 49 50```cpp 51bool Napi::Boolean::Value() const; 52``` 53 54Returns the boolean primitive type of the corresponding `Napi::Boolean` object. 55 56## Operators 57 58### operator bool 59 60Converts a `Napi::Boolean` value to a boolean primitive. 61 62```cpp 63Napi::Boolean::operator bool() const; 64``` 65 66Returns the boolean primitive type of the corresponding `Napi::Boolean` object. 67 68[`Napi::Value`]: ./value.md 69