Sets the value of the specified field.


name String

The name of the field whose value will be returned.

value Number|String|Date|Object

The new value of the field.

Example - set the value of a field

var observable = new{ name: "John Doe" });
observable.set("name", "Jane Doe"); // set the value
console.log(observable.get("name")); //outputs the new value "Jane Doe"

Example - set the value of a nested field

var observable = new{ person: { name: "John Doe" } });
observable.set("", "Jane Doe"); // set the value
console.log(observable.get("")); //outputs the new value "Jane Doe"
In this article
Not finding the help you need? Improve this article