SET_KEY

Set a property of an object

Description

Returns an object containing all the properties from the given object, with the given property key set to the given value. Any existing property under the given key is overridden.

Function signature

SET_KEY(object: Object, propertyname: String, value: ) => Object

Parameter

Description

Object

Object whose property will be set

Property name

Name of the property from object to set

Value

Any value

Examples

obj = {"a":"A","b":"B","c":"C"}
animal = {"name":"dog","weight":123,"active":false,"children":0}

Formula

Return value

SET_KEY(obj, "a", "foo")

{"a":"foo","b":"B","c":"C"}

SET_KEY(animal, "weight", 32)

{"name":"dog","weight":32,"active":false,"children":0}