An associative javascript array is given. It is required to generate a string such that it is an expression of this array. For example, toString({a: 1, b: 2, c: 3, d: 4}) returns "{a: 1, b: 2, c: 3, d: 4}" .

  • Corrected brackets on curly - Constantor

1 answer 1

[a: 1, b: 2, c: 3, d: 4]

So it is impossible))) So it should be:

 JSON.stringify({a: 1, b: 2, c: 3, d: 4})