Object.from_entries

Object.from_entries

Object.from_entries

Function

Create an object from an array of [key, value] entries.

Syntax

Parameters

ParametersTypeRequiredDefault valueDescription
entriesArrayNoCurrent object entries[key, value] Array of entries.

Return value

TypeDescription
ObjectThe new object created.

Return object fields

Return object fields from valid [key, value] entries. The first item of each entry will be converted into the field name, and the second item will be used as the field value; the entry that appears after pressing the field with the same name overwrites the previous entry.

Code Example

Notes

  • Invalid entries will be skipped.
  • The entry that appears after pressing the key with the same name overwrites the previous entry.