object-properties
    Preparing search index...

    Function defineProperties

    • Defines multiple properties on an object at once

      Type Parameters

      • T
      • P extends Record<string, any>

      Parameters

      • target: T
      • Optionalproperties: P
      • Optionaloptions: DefinePropertyOptions
        • Optionalconfigurable?: boolean
        • Optionalenumerable?: boolean
        • Optionalwritable?: boolean

      Returns any

      target

      const person = {};
      defineProperties(person, {
      name: 'John',
      age: 30,
      city: 'New York'
      });
      console.log(person.name); // 'John'
      console.log(person.age); // 30

      // With options
      defineProperties(person, {
      country: 'USA',
      zipCode: '10001'
      }, { enumerable: true });