[Solved] transforming elements in array from numbers to string


Map over the array and assign each key value pair to a new object after converting it to a string.

const array = [{abcd:1, cdef:7},{abcd:2, cdef:8}, {abcd:3, cdef:9}];

array.map(el => {
  const stringObj = {}
  Object.keys(el).forEach(key => {
    stringObj[key] = el[key].toString();
  })
  return stringObj;
})

1

solved transforming elements in array from numbers to string