1# PropertyLValue 2 3The `Napi::Object::PropertyLValue` class is a helper class provided by 4`Napi::Object` to allow more intuitive assignment of properties. 5 6## Example 7```cpp 8#include <napi.h> 9 10using namespace Napi; 11 12Void Init(Env env) { 13 // Create a new instance 14 Object obj = Object::New(env); 15 16 // Assign a value to a property. 17 obj["hello"] = "world"; 18} 19``` 20 21In the above example, `obj["hello"]` returns a `Napi::Object::PropertyLValue` 22whose `operator=()` method accepts a string which will become the value of the 23"hello" property of the newly created object. 24 25In general, `obj[key] = value` is the equivalent of `obj.Set(key, value)`, where 26the types of `key` and `value` are all those supported by 27[`Napi::Object::Set()`](object.md#set). 28 29## Methods 30 31### operator Value() 32 33```cpp 34operator Value() const; 35``` 36 37Implicitly casts this `Napi::Object::PropertyLValue` to a `Napi::Value`. 38 39### operator =() 40 41```cpp 42template <typename ValueType> 43PropertyLValue& operator =(ValueType value); 44``` 45 46* `[in] value` a value to assign to the property referred to by the 47 `Napi::Object::PropertyLValue`. The type of the value is one of the types 48 supported by the second parameter of [`Napi::Object::Set()`](object.md#set). 49 50Returns a self-reference. 51