0

I'm not getting the actual value of my parameter name in the below function. Object.assign taking the function parameter name as a string literal so the resulted JSON object also named as name

see the below code.

enter image description here

Please see the resulted json object i got.

enter image description here

How to fix this?

Abhilash Shajan
  • 610
  • 1
  • 8
  • 29

1 Answers1

1

wrap it with []

return Object.assign(..., {[name]: JSON.parse(...)})
albert
  • 464
  • 2
  • 7