Is there a simple way to convert an array of values:
dataset = [5, 10, 13];
to an array of objects, wherein each object is a key-value pair?
dataset = [ { key: 0, value: 5 },
{ key: 1, value: 10 },
{ key: 2, value: 13 } ];
This example is an abbreviated version of the dataset in the "Data Join with Keys" section of Scott Murray's Interactive Data Visualization for the Web, 2nd ed, p. 187.
I had trouble finding an answer, and therefore I am posting my own solution below.