I have an array of objects. How do I add an id key to them starting from 1.
[ { color: \"red\", value: \"#f00\" }, { color: \"green\", value: \"
source.map((s, i)=> s.id = i+1); console.log(source)