7.3. Convert a key to a value
The steps to convert a key to a value are as follows. These steps take one argument, key, and return an ECMAScript value.
Let type be key’s type.
Let value be key’s value.
Switch on type:
number
Return an ECMAScript Number value equal to value
string
Return an ECMAScript String value equal to value
date
Let date be the result of executing the ECMAScript Date constructor with the single argument value.
Assert: date is not an abrupt completion.
Return date.
*binary*
1. Let len be the length of value.
2. Let buffer be the result of executing the ECMAScript ArrayBuffer constructor with len.
3. Assert: buffer is not an [abrupt completion](https://tc39.github.io/ecma262/#sec-completion-record-specification-type).
4. Set the entries in buffer’s \[\[ArrayBufferData\]\] internal slot to the entries in value.
5. Return buffer.
*array*
1. Let array be the result of executing the ECMAScript Array constructor with no arguments.
2. Assert: array is not an [abrupt completion](https://tc39.github.io/ecma262/#sec-completion-record-specification-type).
3. Let len be the length of value.
4. Let index be 0.
5. While index is less than len:
1. Let entry be the result of running the steps to [convert a key to a value](#convert-a-key-to-a-value) with the indexth entry of value as input.
2. Let status be [CreateDataProperty](https://tc39.github.io/ecma262/#sec-createdataproperty)(array, index, entry).
3. Assert: status is true.
4. Increase index by 1.
6. Return array.