Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "utils/define-property/docs/types/index.d"

Index

Functions

Functions

Export assignment defineProperty

  • Defines (or modifies) an object property.

    Notes

    • Property descriptors come in two flavors: data descriptors and accessor descriptors. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.

    Parameters

    Returns any

    object with added property

    Example

    var obj = {};
    
    defineProperty( obj, 'foo', {
        'value': 'bar'
    });
    
    var str = obj.foo;
    // returns 'bar'