getWithDefault (keyName, defaultValue) Object
public
Retrieves the value of a property, or a default value in the case that the property returns undefined
.
person.getWithDefault('lastName', 'Doe');
Parameters:
-
keyName
String
- The name of the property to retrieve
-
defaultValue
Object
- The value to return if the property value is undefined
Returns:
-
Object
- The property value or the defaultValue.
Please login to continue.