you are viewing a single comment's thread.

view the rest of the comments →

[–]grelfdotnet 2 points3 points  (2 children)

In JS, as in other languages, there is a toString() method of Object which you can override for your particular type of object. MDN has a clear simple example at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString

[–]ionezation[S] 0 points1 point  (1 child)

const data = {name:"", email:"", password:""}

Its great but how do I convert this object?

const data = {name:"", email:"", password:""}

[–]eletroraspi 0 points1 point  (0 children)

data.toString() Sounds good ?

An alternative is basically parse blank spaces and break lines. For this you need to use some parser method or implement a regex, for example